
obj/user/primes.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 cd 00 00 00       	call   8000fe <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <primeproc>:

#include <inc/lib.h>

unsigned
primeproc(void)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	57                   	push   %edi
  80003b:	56                   	push   %esi
  80003c:	53                   	push   %ebx
  80003d:	83 ec 1c             	sub    $0x1c,%esp
	int i, id, p;
	envid_t envid;

	// fetch a prime from our left neighbor
top:
	p = ipc_recv(&envid, 0, 0);
  800040:	8d 75 e4             	lea    -0x1c(%ebp),%esi
  800043:	83 ec 04             	sub    $0x4,%esp
  800046:	6a 00                	push   $0x0
  800048:	6a 00                	push   $0x0
  80004a:	56                   	push   %esi
  80004b:	e8 74 11 00 00       	call   8011c4 <ipc_recv>
  800050:	89 c3                	mov    %eax,%ebx
	cprintf("CPU %d: %d ", thisenv->env_cpunum, p);
  800052:	a1 04 40 80 00       	mov    0x804004,%eax
  800057:	8b 40 5c             	mov    0x5c(%eax),%eax
  80005a:	83 c4 0c             	add    $0xc,%esp
  80005d:	53                   	push   %ebx
  80005e:	50                   	push   %eax
  80005f:	68 60 23 80 00       	push   $0x802360
  800064:	e8 ee 01 00 00       	call   800257 <cprintf>

	// fork a right neighbor to continue the chain
	if ((id = fork()) < 0)
  800069:	e8 3b 0f 00 00       	call   800fa9 <fork>
  80006e:	89 c7                	mov    %eax,%edi
  800070:	83 c4 10             	add    $0x10,%esp
  800073:	85 c0                	test   %eax,%eax
  800075:	78 07                	js     80007e <primeproc+0x4b>
		panic("fork: %e", id);
	if (id == 0)
  800077:	74 ca                	je     800043 <primeproc+0x10>
		goto top;

	// filter out multiples of our prime
	while (1) {
		i = ipc_recv(&envid, 0, 0);
  800079:	8d 75 e4             	lea    -0x1c(%ebp),%esi
  80007c:	eb 20                	jmp    80009e <primeproc+0x6b>
		panic("fork: %e", id);
  80007e:	50                   	push   %eax
  80007f:	68 6c 23 80 00       	push   $0x80236c
  800084:	6a 1a                	push   $0x1a
  800086:	68 75 23 80 00       	push   $0x802375
  80008b:	e8 e0 00 00 00       	call   800170 <_panic>
		if (i % p)
			ipc_send(id, i, 0, 0);
  800090:	6a 00                	push   $0x0
  800092:	6a 00                	push   $0x0
  800094:	51                   	push   %ecx
  800095:	57                   	push   %edi
  800096:	e8 aa 11 00 00       	call   801245 <ipc_send>
  80009b:	83 c4 10             	add    $0x10,%esp
		i = ipc_recv(&envid, 0, 0);
  80009e:	83 ec 04             	sub    $0x4,%esp
  8000a1:	6a 00                	push   $0x0
  8000a3:	6a 00                	push   $0x0
  8000a5:	56                   	push   %esi
  8000a6:	e8 19 11 00 00       	call   8011c4 <ipc_recv>
  8000ab:	89 c1                	mov    %eax,%ecx
		if (i % p)
  8000ad:	99                   	cltd   
  8000ae:	f7 fb                	idiv   %ebx
  8000b0:	83 c4 10             	add    $0x10,%esp
  8000b3:	85 d2                	test   %edx,%edx
  8000b5:	74 e7                	je     80009e <primeproc+0x6b>
  8000b7:	eb d7                	jmp    800090 <primeproc+0x5d>

008000b9 <umain>:
	}
}

void
umain(int argc, char **argv)
{
  8000b9:	f3 0f 1e fb          	endbr32 
  8000bd:	55                   	push   %ebp
  8000be:	89 e5                	mov    %esp,%ebp
  8000c0:	56                   	push   %esi
  8000c1:	53                   	push   %ebx
	int i, id;

	// fork the first prime process in the chain
	if ((id = fork()) < 0)
  8000c2:	e8 e2 0e 00 00       	call   800fa9 <fork>
  8000c7:	89 c6                	mov    %eax,%esi
  8000c9:	85 c0                	test   %eax,%eax
  8000cb:	78 1a                	js     8000e7 <umain+0x2e>
		panic("fork: %e", id);
	if (id == 0)
		primeproc();

	// feed all the integers through
	for (i = 2; ; i++)
  8000cd:	bb 02 00 00 00       	mov    $0x2,%ebx
	if (id == 0)
  8000d2:	74 25                	je     8000f9 <umain+0x40>
		ipc_send(id, i, 0, 0);
  8000d4:	6a 00                	push   $0x0
  8000d6:	6a 00                	push   $0x0
  8000d8:	53                   	push   %ebx
  8000d9:	56                   	push   %esi
  8000da:	e8 66 11 00 00       	call   801245 <ipc_send>
	for (i = 2; ; i++)
  8000df:	83 c3 01             	add    $0x1,%ebx
  8000e2:	83 c4 10             	add    $0x10,%esp
  8000e5:	eb ed                	jmp    8000d4 <umain+0x1b>
		panic("fork: %e", id);
  8000e7:	50                   	push   %eax
  8000e8:	68 6c 23 80 00       	push   $0x80236c
  8000ed:	6a 2d                	push   $0x2d
  8000ef:	68 75 23 80 00       	push   $0x802375
  8000f4:	e8 77 00 00 00       	call   800170 <_panic>
		primeproc();
  8000f9:	e8 35 ff ff ff       	call   800033 <primeproc>

008000fe <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000fe:	f3 0f 1e fb          	endbr32 
  800102:	55                   	push   %ebp
  800103:	89 e5                	mov    %esp,%ebp
  800105:	56                   	push   %esi
  800106:	53                   	push   %ebx
  800107:	8b 5d 08             	mov    0x8(%ebp),%ebx
  80010a:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  80010d:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  800114:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  800117:	e8 10 0b 00 00       	call   800c2c <sys_getenvid>
  80011c:	25 ff 03 00 00       	and    $0x3ff,%eax
  800121:	6b c0 7c             	imul   $0x7c,%eax,%eax
  800124:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800129:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  80012e:	85 db                	test   %ebx,%ebx
  800130:	7e 07                	jle    800139 <libmain+0x3b>
		binaryname = argv[0];
  800132:	8b 06                	mov    (%esi),%eax
  800134:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  800139:	83 ec 08             	sub    $0x8,%esp
  80013c:	56                   	push   %esi
  80013d:	53                   	push   %ebx
  80013e:	e8 76 ff ff ff       	call   8000b9 <umain>

	// exit gracefully
	exit();
  800143:	e8 0a 00 00 00       	call   800152 <exit>
}
  800148:	83 c4 10             	add    $0x10,%esp
  80014b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80014e:	5b                   	pop    %ebx
  80014f:	5e                   	pop    %esi
  800150:	5d                   	pop    %ebp
  800151:	c3                   	ret    

00800152 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800152:	f3 0f 1e fb          	endbr32 
  800156:	55                   	push   %ebp
  800157:	89 e5                	mov    %esp,%ebp
  800159:	83 ec 08             	sub    $0x8,%esp
	close_all();
  80015c:	e8 68 13 00 00       	call   8014c9 <close_all>
	sys_env_destroy(0);
  800161:	83 ec 0c             	sub    $0xc,%esp
  800164:	6a 00                	push   $0x0
  800166:	e8 7c 0a 00 00       	call   800be7 <sys_env_destroy>
}
  80016b:	83 c4 10             	add    $0x10,%esp
  80016e:	c9                   	leave  
  80016f:	c3                   	ret    

00800170 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800170:	f3 0f 1e fb          	endbr32 
  800174:	55                   	push   %ebp
  800175:	89 e5                	mov    %esp,%ebp
  800177:	56                   	push   %esi
  800178:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800179:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  80017c:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800182:	e8 a5 0a 00 00       	call   800c2c <sys_getenvid>
  800187:	83 ec 0c             	sub    $0xc,%esp
  80018a:	ff 75 0c             	pushl  0xc(%ebp)
  80018d:	ff 75 08             	pushl  0x8(%ebp)
  800190:	56                   	push   %esi
  800191:	50                   	push   %eax
  800192:	68 90 23 80 00       	push   $0x802390
  800197:	e8 bb 00 00 00       	call   800257 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  80019c:	83 c4 18             	add    $0x18,%esp
  80019f:	53                   	push   %ebx
  8001a0:	ff 75 10             	pushl  0x10(%ebp)
  8001a3:	e8 5a 00 00 00       	call   800202 <vcprintf>
	cprintf("\n");
  8001a8:	c7 04 24 33 29 80 00 	movl   $0x802933,(%esp)
  8001af:	e8 a3 00 00 00       	call   800257 <cprintf>
  8001b4:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  8001b7:	cc                   	int3   
  8001b8:	eb fd                	jmp    8001b7 <_panic+0x47>

008001ba <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  8001ba:	f3 0f 1e fb          	endbr32 
  8001be:	55                   	push   %ebp
  8001bf:	89 e5                	mov    %esp,%ebp
  8001c1:	53                   	push   %ebx
  8001c2:	83 ec 04             	sub    $0x4,%esp
  8001c5:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  8001c8:	8b 13                	mov    (%ebx),%edx
  8001ca:	8d 42 01             	lea    0x1(%edx),%eax
  8001cd:	89 03                	mov    %eax,(%ebx)
  8001cf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8001d2:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8001d6:	3d ff 00 00 00       	cmp    $0xff,%eax
  8001db:	74 09                	je     8001e6 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8001dd:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8001e1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8001e4:	c9                   	leave  
  8001e5:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8001e6:	83 ec 08             	sub    $0x8,%esp
  8001e9:	68 ff 00 00 00       	push   $0xff
  8001ee:	8d 43 08             	lea    0x8(%ebx),%eax
  8001f1:	50                   	push   %eax
  8001f2:	e8 ab 09 00 00       	call   800ba2 <sys_cputs>
		b->idx = 0;
  8001f7:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8001fd:	83 c4 10             	add    $0x10,%esp
  800200:	eb db                	jmp    8001dd <putch+0x23>

00800202 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800202:	f3 0f 1e fb          	endbr32 
  800206:	55                   	push   %ebp
  800207:	89 e5                	mov    %esp,%ebp
  800209:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80020f:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800216:	00 00 00 
	b.cnt = 0;
  800219:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800220:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800223:	ff 75 0c             	pushl  0xc(%ebp)
  800226:	ff 75 08             	pushl  0x8(%ebp)
  800229:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  80022f:	50                   	push   %eax
  800230:	68 ba 01 80 00       	push   $0x8001ba
  800235:	e8 20 01 00 00       	call   80035a <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80023a:	83 c4 08             	add    $0x8,%esp
  80023d:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800243:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  800249:	50                   	push   %eax
  80024a:	e8 53 09 00 00       	call   800ba2 <sys_cputs>

	return b.cnt;
}
  80024f:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  800255:	c9                   	leave  
  800256:	c3                   	ret    

00800257 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  800257:	f3 0f 1e fb          	endbr32 
  80025b:	55                   	push   %ebp
  80025c:	89 e5                	mov    %esp,%ebp
  80025e:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800261:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  800264:	50                   	push   %eax
  800265:	ff 75 08             	pushl  0x8(%ebp)
  800268:	e8 95 ff ff ff       	call   800202 <vcprintf>
	va_end(ap);

	return cnt;
}
  80026d:	c9                   	leave  
  80026e:	c3                   	ret    

0080026f <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  80026f:	55                   	push   %ebp
  800270:	89 e5                	mov    %esp,%ebp
  800272:	57                   	push   %edi
  800273:	56                   	push   %esi
  800274:	53                   	push   %ebx
  800275:	83 ec 1c             	sub    $0x1c,%esp
  800278:	89 c7                	mov    %eax,%edi
  80027a:	89 d6                	mov    %edx,%esi
  80027c:	8b 45 08             	mov    0x8(%ebp),%eax
  80027f:	8b 55 0c             	mov    0xc(%ebp),%edx
  800282:	89 d1                	mov    %edx,%ecx
  800284:	89 c2                	mov    %eax,%edx
  800286:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800289:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80028c:	8b 45 10             	mov    0x10(%ebp),%eax
  80028f:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800292:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800295:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80029c:	39 c2                	cmp    %eax,%edx
  80029e:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  8002a1:	72 3e                	jb     8002e1 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  8002a3:	83 ec 0c             	sub    $0xc,%esp
  8002a6:	ff 75 18             	pushl  0x18(%ebp)
  8002a9:	83 eb 01             	sub    $0x1,%ebx
  8002ac:	53                   	push   %ebx
  8002ad:	50                   	push   %eax
  8002ae:	83 ec 08             	sub    $0x8,%esp
  8002b1:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002b4:	ff 75 e0             	pushl  -0x20(%ebp)
  8002b7:	ff 75 dc             	pushl  -0x24(%ebp)
  8002ba:	ff 75 d8             	pushl  -0x28(%ebp)
  8002bd:	e8 3e 1e 00 00       	call   802100 <__udivdi3>
  8002c2:	83 c4 18             	add    $0x18,%esp
  8002c5:	52                   	push   %edx
  8002c6:	50                   	push   %eax
  8002c7:	89 f2                	mov    %esi,%edx
  8002c9:	89 f8                	mov    %edi,%eax
  8002cb:	e8 9f ff ff ff       	call   80026f <printnum>
  8002d0:	83 c4 20             	add    $0x20,%esp
  8002d3:	eb 13                	jmp    8002e8 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8002d5:	83 ec 08             	sub    $0x8,%esp
  8002d8:	56                   	push   %esi
  8002d9:	ff 75 18             	pushl  0x18(%ebp)
  8002dc:	ff d7                	call   *%edi
  8002de:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8002e1:	83 eb 01             	sub    $0x1,%ebx
  8002e4:	85 db                	test   %ebx,%ebx
  8002e6:	7f ed                	jg     8002d5 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8002e8:	83 ec 08             	sub    $0x8,%esp
  8002eb:	56                   	push   %esi
  8002ec:	83 ec 04             	sub    $0x4,%esp
  8002ef:	ff 75 e4             	pushl  -0x1c(%ebp)
  8002f2:	ff 75 e0             	pushl  -0x20(%ebp)
  8002f5:	ff 75 dc             	pushl  -0x24(%ebp)
  8002f8:	ff 75 d8             	pushl  -0x28(%ebp)
  8002fb:	e8 10 1f 00 00       	call   802210 <__umoddi3>
  800300:	83 c4 14             	add    $0x14,%esp
  800303:	0f be 80 b3 23 80 00 	movsbl 0x8023b3(%eax),%eax
  80030a:	50                   	push   %eax
  80030b:	ff d7                	call   *%edi
}
  80030d:	83 c4 10             	add    $0x10,%esp
  800310:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800313:	5b                   	pop    %ebx
  800314:	5e                   	pop    %esi
  800315:	5f                   	pop    %edi
  800316:	5d                   	pop    %ebp
  800317:	c3                   	ret    

00800318 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800318:	f3 0f 1e fb          	endbr32 
  80031c:	55                   	push   %ebp
  80031d:	89 e5                	mov    %esp,%ebp
  80031f:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800322:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800326:	8b 10                	mov    (%eax),%edx
  800328:	3b 50 04             	cmp    0x4(%eax),%edx
  80032b:	73 0a                	jae    800337 <sprintputch+0x1f>
		*b->buf++ = ch;
  80032d:	8d 4a 01             	lea    0x1(%edx),%ecx
  800330:	89 08                	mov    %ecx,(%eax)
  800332:	8b 45 08             	mov    0x8(%ebp),%eax
  800335:	88 02                	mov    %al,(%edx)
}
  800337:	5d                   	pop    %ebp
  800338:	c3                   	ret    

00800339 <printfmt>:
{
  800339:	f3 0f 1e fb          	endbr32 
  80033d:	55                   	push   %ebp
  80033e:	89 e5                	mov    %esp,%ebp
  800340:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800343:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  800346:	50                   	push   %eax
  800347:	ff 75 10             	pushl  0x10(%ebp)
  80034a:	ff 75 0c             	pushl  0xc(%ebp)
  80034d:	ff 75 08             	pushl  0x8(%ebp)
  800350:	e8 05 00 00 00       	call   80035a <vprintfmt>
}
  800355:	83 c4 10             	add    $0x10,%esp
  800358:	c9                   	leave  
  800359:	c3                   	ret    

0080035a <vprintfmt>:
{
  80035a:	f3 0f 1e fb          	endbr32 
  80035e:	55                   	push   %ebp
  80035f:	89 e5                	mov    %esp,%ebp
  800361:	57                   	push   %edi
  800362:	56                   	push   %esi
  800363:	53                   	push   %ebx
  800364:	83 ec 3c             	sub    $0x3c,%esp
  800367:	8b 75 08             	mov    0x8(%ebp),%esi
  80036a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  80036d:	8b 7d 10             	mov    0x10(%ebp),%edi
  800370:	e9 5d 03 00 00       	jmp    8006d2 <vprintfmt+0x378>
		padc = ' ';
  800375:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800379:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800380:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800387:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  80038e:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800393:	8d 47 01             	lea    0x1(%edi),%eax
  800396:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800399:	0f b6 17             	movzbl (%edi),%edx
  80039c:	8d 42 dd             	lea    -0x23(%edx),%eax
  80039f:	3c 55                	cmp    $0x55,%al
  8003a1:	0f 87 ae 03 00 00    	ja     800755 <vprintfmt+0x3fb>
  8003a7:	0f b6 c0             	movzbl %al,%eax
  8003aa:	3e ff 24 85 00 25 80 	notrack jmp *0x802500(,%eax,4)
  8003b1:	00 
  8003b2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  8003b5:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  8003b9:	eb d8                	jmp    800393 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8003bb:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  8003be:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  8003c2:	eb cf                	jmp    800393 <vprintfmt+0x39>
  8003c4:	0f b6 d2             	movzbl %dl,%edx
  8003c7:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8003ca:	b8 00 00 00 00       	mov    $0x0,%eax
  8003cf:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8003d2:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8003d5:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8003d9:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8003dc:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8003df:	83 f9 09             	cmp    $0x9,%ecx
  8003e2:	77 55                	ja     800439 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8003e4:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8003e7:	eb e9                	jmp    8003d2 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8003e9:	8b 45 14             	mov    0x14(%ebp),%eax
  8003ec:	8b 00                	mov    (%eax),%eax
  8003ee:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003f1:	8b 45 14             	mov    0x14(%ebp),%eax
  8003f4:	8d 40 04             	lea    0x4(%eax),%eax
  8003f7:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8003fa:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8003fd:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800401:	79 90                	jns    800393 <vprintfmt+0x39>
				width = precision, precision = -1;
  800403:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800406:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800409:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800410:	eb 81                	jmp    800393 <vprintfmt+0x39>
  800412:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800415:	85 c0                	test   %eax,%eax
  800417:	ba 00 00 00 00       	mov    $0x0,%edx
  80041c:	0f 49 d0             	cmovns %eax,%edx
  80041f:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800422:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800425:	e9 69 ff ff ff       	jmp    800393 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80042a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  80042d:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  800434:	e9 5a ff ff ff       	jmp    800393 <vprintfmt+0x39>
  800439:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  80043c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80043f:	eb bc                	jmp    8003fd <vprintfmt+0xa3>
			lflag++;
  800441:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800444:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800447:	e9 47 ff ff ff       	jmp    800393 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  80044c:	8b 45 14             	mov    0x14(%ebp),%eax
  80044f:	8d 78 04             	lea    0x4(%eax),%edi
  800452:	83 ec 08             	sub    $0x8,%esp
  800455:	53                   	push   %ebx
  800456:	ff 30                	pushl  (%eax)
  800458:	ff d6                	call   *%esi
			break;
  80045a:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  80045d:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800460:	e9 6a 02 00 00       	jmp    8006cf <vprintfmt+0x375>
			err = va_arg(ap, int);
  800465:	8b 45 14             	mov    0x14(%ebp),%eax
  800468:	8d 78 04             	lea    0x4(%eax),%edi
  80046b:	8b 00                	mov    (%eax),%eax
  80046d:	99                   	cltd   
  80046e:	31 d0                	xor    %edx,%eax
  800470:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800472:	83 f8 0f             	cmp    $0xf,%eax
  800475:	7f 23                	jg     80049a <vprintfmt+0x140>
  800477:	8b 14 85 60 26 80 00 	mov    0x802660(,%eax,4),%edx
  80047e:	85 d2                	test   %edx,%edx
  800480:	74 18                	je     80049a <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800482:	52                   	push   %edx
  800483:	68 01 29 80 00       	push   $0x802901
  800488:	53                   	push   %ebx
  800489:	56                   	push   %esi
  80048a:	e8 aa fe ff ff       	call   800339 <printfmt>
  80048f:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800492:	89 7d 14             	mov    %edi,0x14(%ebp)
  800495:	e9 35 02 00 00       	jmp    8006cf <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80049a:	50                   	push   %eax
  80049b:	68 cb 23 80 00       	push   $0x8023cb
  8004a0:	53                   	push   %ebx
  8004a1:	56                   	push   %esi
  8004a2:	e8 92 fe ff ff       	call   800339 <printfmt>
  8004a7:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  8004aa:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  8004ad:	e9 1d 02 00 00       	jmp    8006cf <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  8004b2:	8b 45 14             	mov    0x14(%ebp),%eax
  8004b5:	83 c0 04             	add    $0x4,%eax
  8004b8:	89 45 c8             	mov    %eax,-0x38(%ebp)
  8004bb:	8b 45 14             	mov    0x14(%ebp),%eax
  8004be:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  8004c0:	85 d2                	test   %edx,%edx
  8004c2:	b8 c4 23 80 00       	mov    $0x8023c4,%eax
  8004c7:	0f 45 c2             	cmovne %edx,%eax
  8004ca:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8004cd:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004d1:	7e 06                	jle    8004d9 <vprintfmt+0x17f>
  8004d3:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8004d7:	75 0d                	jne    8004e6 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8004d9:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8004dc:	89 c7                	mov    %eax,%edi
  8004de:	03 45 d4             	add    -0x2c(%ebp),%eax
  8004e1:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004e4:	eb 55                	jmp    80053b <vprintfmt+0x1e1>
  8004e6:	83 ec 08             	sub    $0x8,%esp
  8004e9:	ff 75 d8             	pushl  -0x28(%ebp)
  8004ec:	ff 75 cc             	pushl  -0x34(%ebp)
  8004ef:	e8 15 03 00 00       	call   800809 <strnlen>
  8004f4:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8004f7:	29 c2                	sub    %eax,%edx
  8004f9:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8004fc:	83 c4 10             	add    $0x10,%esp
  8004ff:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800501:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800505:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800508:	85 ff                	test   %edi,%edi
  80050a:	7e 11                	jle    80051d <vprintfmt+0x1c3>
					putch(padc, putdat);
  80050c:	83 ec 08             	sub    $0x8,%esp
  80050f:	53                   	push   %ebx
  800510:	ff 75 d4             	pushl  -0x2c(%ebp)
  800513:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800515:	83 ef 01             	sub    $0x1,%edi
  800518:	83 c4 10             	add    $0x10,%esp
  80051b:	eb eb                	jmp    800508 <vprintfmt+0x1ae>
  80051d:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800520:	85 d2                	test   %edx,%edx
  800522:	b8 00 00 00 00       	mov    $0x0,%eax
  800527:	0f 49 c2             	cmovns %edx,%eax
  80052a:	29 c2                	sub    %eax,%edx
  80052c:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  80052f:	eb a8                	jmp    8004d9 <vprintfmt+0x17f>
					putch(ch, putdat);
  800531:	83 ec 08             	sub    $0x8,%esp
  800534:	53                   	push   %ebx
  800535:	52                   	push   %edx
  800536:	ff d6                	call   *%esi
  800538:	83 c4 10             	add    $0x10,%esp
  80053b:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80053e:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800540:	83 c7 01             	add    $0x1,%edi
  800543:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800547:	0f be d0             	movsbl %al,%edx
  80054a:	85 d2                	test   %edx,%edx
  80054c:	74 4b                	je     800599 <vprintfmt+0x23f>
  80054e:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800552:	78 06                	js     80055a <vprintfmt+0x200>
  800554:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800558:	78 1e                	js     800578 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  80055a:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  80055e:	74 d1                	je     800531 <vprintfmt+0x1d7>
  800560:	0f be c0             	movsbl %al,%eax
  800563:	83 e8 20             	sub    $0x20,%eax
  800566:	83 f8 5e             	cmp    $0x5e,%eax
  800569:	76 c6                	jbe    800531 <vprintfmt+0x1d7>
					putch('?', putdat);
  80056b:	83 ec 08             	sub    $0x8,%esp
  80056e:	53                   	push   %ebx
  80056f:	6a 3f                	push   $0x3f
  800571:	ff d6                	call   *%esi
  800573:	83 c4 10             	add    $0x10,%esp
  800576:	eb c3                	jmp    80053b <vprintfmt+0x1e1>
  800578:	89 cf                	mov    %ecx,%edi
  80057a:	eb 0e                	jmp    80058a <vprintfmt+0x230>
				putch(' ', putdat);
  80057c:	83 ec 08             	sub    $0x8,%esp
  80057f:	53                   	push   %ebx
  800580:	6a 20                	push   $0x20
  800582:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800584:	83 ef 01             	sub    $0x1,%edi
  800587:	83 c4 10             	add    $0x10,%esp
  80058a:	85 ff                	test   %edi,%edi
  80058c:	7f ee                	jg     80057c <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  80058e:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800591:	89 45 14             	mov    %eax,0x14(%ebp)
  800594:	e9 36 01 00 00       	jmp    8006cf <vprintfmt+0x375>
  800599:	89 cf                	mov    %ecx,%edi
  80059b:	eb ed                	jmp    80058a <vprintfmt+0x230>
	if (lflag >= 2)
  80059d:	83 f9 01             	cmp    $0x1,%ecx
  8005a0:	7f 1f                	jg     8005c1 <vprintfmt+0x267>
	else if (lflag)
  8005a2:	85 c9                	test   %ecx,%ecx
  8005a4:	74 67                	je     80060d <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  8005a6:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a9:	8b 00                	mov    (%eax),%eax
  8005ab:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005ae:	89 c1                	mov    %eax,%ecx
  8005b0:	c1 f9 1f             	sar    $0x1f,%ecx
  8005b3:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8005b6:	8b 45 14             	mov    0x14(%ebp),%eax
  8005b9:	8d 40 04             	lea    0x4(%eax),%eax
  8005bc:	89 45 14             	mov    %eax,0x14(%ebp)
  8005bf:	eb 17                	jmp    8005d8 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  8005c1:	8b 45 14             	mov    0x14(%ebp),%eax
  8005c4:	8b 50 04             	mov    0x4(%eax),%edx
  8005c7:	8b 00                	mov    (%eax),%eax
  8005c9:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005cc:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8005cf:	8b 45 14             	mov    0x14(%ebp),%eax
  8005d2:	8d 40 08             	lea    0x8(%eax),%eax
  8005d5:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8005d8:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005db:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8005de:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005e3:	85 c9                	test   %ecx,%ecx
  8005e5:	0f 89 ca 00 00 00    	jns    8006b5 <vprintfmt+0x35b>
				putch('-', putdat);
  8005eb:	83 ec 08             	sub    $0x8,%esp
  8005ee:	53                   	push   %ebx
  8005ef:	6a 2d                	push   $0x2d
  8005f1:	ff d6                	call   *%esi
				num = -(long long) num;
  8005f3:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8005f6:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8005f9:	f7 da                	neg    %edx
  8005fb:	83 d1 00             	adc    $0x0,%ecx
  8005fe:	f7 d9                	neg    %ecx
  800600:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800603:	b8 0a 00 00 00       	mov    $0xa,%eax
  800608:	e9 a8 00 00 00       	jmp    8006b5 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80060d:	8b 45 14             	mov    0x14(%ebp),%eax
  800610:	8b 00                	mov    (%eax),%eax
  800612:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800615:	99                   	cltd   
  800616:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800619:	8b 45 14             	mov    0x14(%ebp),%eax
  80061c:	8d 40 04             	lea    0x4(%eax),%eax
  80061f:	89 45 14             	mov    %eax,0x14(%ebp)
  800622:	eb b4                	jmp    8005d8 <vprintfmt+0x27e>
	if (lflag >= 2)
  800624:	83 f9 01             	cmp    $0x1,%ecx
  800627:	7f 1b                	jg     800644 <vprintfmt+0x2ea>
	else if (lflag)
  800629:	85 c9                	test   %ecx,%ecx
  80062b:	74 2c                	je     800659 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80062d:	8b 45 14             	mov    0x14(%ebp),%eax
  800630:	8b 10                	mov    (%eax),%edx
  800632:	b9 00 00 00 00       	mov    $0x0,%ecx
  800637:	8d 40 04             	lea    0x4(%eax),%eax
  80063a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80063d:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800642:	eb 71                	jmp    8006b5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800644:	8b 45 14             	mov    0x14(%ebp),%eax
  800647:	8b 10                	mov    (%eax),%edx
  800649:	8b 48 04             	mov    0x4(%eax),%ecx
  80064c:	8d 40 08             	lea    0x8(%eax),%eax
  80064f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800652:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800657:	eb 5c                	jmp    8006b5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800659:	8b 45 14             	mov    0x14(%ebp),%eax
  80065c:	8b 10                	mov    (%eax),%edx
  80065e:	b9 00 00 00 00       	mov    $0x0,%ecx
  800663:	8d 40 04             	lea    0x4(%eax),%eax
  800666:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800669:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  80066e:	eb 45                	jmp    8006b5 <vprintfmt+0x35b>
			putch('X', putdat);
  800670:	83 ec 08             	sub    $0x8,%esp
  800673:	53                   	push   %ebx
  800674:	6a 58                	push   $0x58
  800676:	ff d6                	call   *%esi
			putch('X', putdat);
  800678:	83 c4 08             	add    $0x8,%esp
  80067b:	53                   	push   %ebx
  80067c:	6a 58                	push   $0x58
  80067e:	ff d6                	call   *%esi
			putch('X', putdat);
  800680:	83 c4 08             	add    $0x8,%esp
  800683:	53                   	push   %ebx
  800684:	6a 58                	push   $0x58
  800686:	ff d6                	call   *%esi
			break;
  800688:	83 c4 10             	add    $0x10,%esp
  80068b:	eb 42                	jmp    8006cf <vprintfmt+0x375>
			putch('0', putdat);
  80068d:	83 ec 08             	sub    $0x8,%esp
  800690:	53                   	push   %ebx
  800691:	6a 30                	push   $0x30
  800693:	ff d6                	call   *%esi
			putch('x', putdat);
  800695:	83 c4 08             	add    $0x8,%esp
  800698:	53                   	push   %ebx
  800699:	6a 78                	push   $0x78
  80069b:	ff d6                	call   *%esi
			num = (unsigned long long)
  80069d:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a0:	8b 10                	mov    (%eax),%edx
  8006a2:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  8006a7:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  8006aa:	8d 40 04             	lea    0x4(%eax),%eax
  8006ad:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006b0:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  8006b5:	83 ec 0c             	sub    $0xc,%esp
  8006b8:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  8006bc:	57                   	push   %edi
  8006bd:	ff 75 d4             	pushl  -0x2c(%ebp)
  8006c0:	50                   	push   %eax
  8006c1:	51                   	push   %ecx
  8006c2:	52                   	push   %edx
  8006c3:	89 da                	mov    %ebx,%edx
  8006c5:	89 f0                	mov    %esi,%eax
  8006c7:	e8 a3 fb ff ff       	call   80026f <printnum>
			break;
  8006cc:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8006cf:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8006d2:	83 c7 01             	add    $0x1,%edi
  8006d5:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8006d9:	83 f8 25             	cmp    $0x25,%eax
  8006dc:	0f 84 93 fc ff ff    	je     800375 <vprintfmt+0x1b>
			if (ch == '\0')
  8006e2:	85 c0                	test   %eax,%eax
  8006e4:	0f 84 8b 00 00 00    	je     800775 <vprintfmt+0x41b>
			putch(ch, putdat);
  8006ea:	83 ec 08             	sub    $0x8,%esp
  8006ed:	53                   	push   %ebx
  8006ee:	50                   	push   %eax
  8006ef:	ff d6                	call   *%esi
  8006f1:	83 c4 10             	add    $0x10,%esp
  8006f4:	eb dc                	jmp    8006d2 <vprintfmt+0x378>
	if (lflag >= 2)
  8006f6:	83 f9 01             	cmp    $0x1,%ecx
  8006f9:	7f 1b                	jg     800716 <vprintfmt+0x3bc>
	else if (lflag)
  8006fb:	85 c9                	test   %ecx,%ecx
  8006fd:	74 2c                	je     80072b <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8006ff:	8b 45 14             	mov    0x14(%ebp),%eax
  800702:	8b 10                	mov    (%eax),%edx
  800704:	b9 00 00 00 00       	mov    $0x0,%ecx
  800709:	8d 40 04             	lea    0x4(%eax),%eax
  80070c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80070f:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800714:	eb 9f                	jmp    8006b5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800716:	8b 45 14             	mov    0x14(%ebp),%eax
  800719:	8b 10                	mov    (%eax),%edx
  80071b:	8b 48 04             	mov    0x4(%eax),%ecx
  80071e:	8d 40 08             	lea    0x8(%eax),%eax
  800721:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800724:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800729:	eb 8a                	jmp    8006b5 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80072b:	8b 45 14             	mov    0x14(%ebp),%eax
  80072e:	8b 10                	mov    (%eax),%edx
  800730:	b9 00 00 00 00       	mov    $0x0,%ecx
  800735:	8d 40 04             	lea    0x4(%eax),%eax
  800738:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  80073b:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800740:	e9 70 ff ff ff       	jmp    8006b5 <vprintfmt+0x35b>
			putch(ch, putdat);
  800745:	83 ec 08             	sub    $0x8,%esp
  800748:	53                   	push   %ebx
  800749:	6a 25                	push   $0x25
  80074b:	ff d6                	call   *%esi
			break;
  80074d:	83 c4 10             	add    $0x10,%esp
  800750:	e9 7a ff ff ff       	jmp    8006cf <vprintfmt+0x375>
			putch('%', putdat);
  800755:	83 ec 08             	sub    $0x8,%esp
  800758:	53                   	push   %ebx
  800759:	6a 25                	push   $0x25
  80075b:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  80075d:	83 c4 10             	add    $0x10,%esp
  800760:	89 f8                	mov    %edi,%eax
  800762:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800766:	74 05                	je     80076d <vprintfmt+0x413>
  800768:	83 e8 01             	sub    $0x1,%eax
  80076b:	eb f5                	jmp    800762 <vprintfmt+0x408>
  80076d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800770:	e9 5a ff ff ff       	jmp    8006cf <vprintfmt+0x375>
}
  800775:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800778:	5b                   	pop    %ebx
  800779:	5e                   	pop    %esi
  80077a:	5f                   	pop    %edi
  80077b:	5d                   	pop    %ebp
  80077c:	c3                   	ret    

0080077d <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  80077d:	f3 0f 1e fb          	endbr32 
  800781:	55                   	push   %ebp
  800782:	89 e5                	mov    %esp,%ebp
  800784:	83 ec 18             	sub    $0x18,%esp
  800787:	8b 45 08             	mov    0x8(%ebp),%eax
  80078a:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  80078d:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800790:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800794:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800797:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80079e:	85 c0                	test   %eax,%eax
  8007a0:	74 26                	je     8007c8 <vsnprintf+0x4b>
  8007a2:	85 d2                	test   %edx,%edx
  8007a4:	7e 22                	jle    8007c8 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  8007a6:	ff 75 14             	pushl  0x14(%ebp)
  8007a9:	ff 75 10             	pushl  0x10(%ebp)
  8007ac:	8d 45 ec             	lea    -0x14(%ebp),%eax
  8007af:	50                   	push   %eax
  8007b0:	68 18 03 80 00       	push   $0x800318
  8007b5:	e8 a0 fb ff ff       	call   80035a <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  8007ba:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8007bd:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  8007c0:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8007c3:	83 c4 10             	add    $0x10,%esp
}
  8007c6:	c9                   	leave  
  8007c7:	c3                   	ret    
		return -E_INVAL;
  8007c8:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8007cd:	eb f7                	jmp    8007c6 <vsnprintf+0x49>

008007cf <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8007cf:	f3 0f 1e fb          	endbr32 
  8007d3:	55                   	push   %ebp
  8007d4:	89 e5                	mov    %esp,%ebp
  8007d6:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8007d9:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8007dc:	50                   	push   %eax
  8007dd:	ff 75 10             	pushl  0x10(%ebp)
  8007e0:	ff 75 0c             	pushl  0xc(%ebp)
  8007e3:	ff 75 08             	pushl  0x8(%ebp)
  8007e6:	e8 92 ff ff ff       	call   80077d <vsnprintf>
	va_end(ap);

	return rc;
}
  8007eb:	c9                   	leave  
  8007ec:	c3                   	ret    

008007ed <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007ed:	f3 0f 1e fb          	endbr32 
  8007f1:	55                   	push   %ebp
  8007f2:	89 e5                	mov    %esp,%ebp
  8007f4:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007f7:	b8 00 00 00 00       	mov    $0x0,%eax
  8007fc:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800800:	74 05                	je     800807 <strlen+0x1a>
		n++;
  800802:	83 c0 01             	add    $0x1,%eax
  800805:	eb f5                	jmp    8007fc <strlen+0xf>
	return n;
}
  800807:	5d                   	pop    %ebp
  800808:	c3                   	ret    

00800809 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800809:	f3 0f 1e fb          	endbr32 
  80080d:	55                   	push   %ebp
  80080e:	89 e5                	mov    %esp,%ebp
  800810:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800813:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800816:	b8 00 00 00 00       	mov    $0x0,%eax
  80081b:	39 d0                	cmp    %edx,%eax
  80081d:	74 0d                	je     80082c <strnlen+0x23>
  80081f:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800823:	74 05                	je     80082a <strnlen+0x21>
		n++;
  800825:	83 c0 01             	add    $0x1,%eax
  800828:	eb f1                	jmp    80081b <strnlen+0x12>
  80082a:	89 c2                	mov    %eax,%edx
	return n;
}
  80082c:	89 d0                	mov    %edx,%eax
  80082e:	5d                   	pop    %ebp
  80082f:	c3                   	ret    

00800830 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800830:	f3 0f 1e fb          	endbr32 
  800834:	55                   	push   %ebp
  800835:	89 e5                	mov    %esp,%ebp
  800837:	53                   	push   %ebx
  800838:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80083b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  80083e:	b8 00 00 00 00       	mov    $0x0,%eax
  800843:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800847:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  80084a:	83 c0 01             	add    $0x1,%eax
  80084d:	84 d2                	test   %dl,%dl
  80084f:	75 f2                	jne    800843 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800851:	89 c8                	mov    %ecx,%eax
  800853:	5b                   	pop    %ebx
  800854:	5d                   	pop    %ebp
  800855:	c3                   	ret    

00800856 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800856:	f3 0f 1e fb          	endbr32 
  80085a:	55                   	push   %ebp
  80085b:	89 e5                	mov    %esp,%ebp
  80085d:	53                   	push   %ebx
  80085e:	83 ec 10             	sub    $0x10,%esp
  800861:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800864:	53                   	push   %ebx
  800865:	e8 83 ff ff ff       	call   8007ed <strlen>
  80086a:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  80086d:	ff 75 0c             	pushl  0xc(%ebp)
  800870:	01 d8                	add    %ebx,%eax
  800872:	50                   	push   %eax
  800873:	e8 b8 ff ff ff       	call   800830 <strcpy>
	return dst;
}
  800878:	89 d8                	mov    %ebx,%eax
  80087a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80087d:	c9                   	leave  
  80087e:	c3                   	ret    

0080087f <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80087f:	f3 0f 1e fb          	endbr32 
  800883:	55                   	push   %ebp
  800884:	89 e5                	mov    %esp,%ebp
  800886:	56                   	push   %esi
  800887:	53                   	push   %ebx
  800888:	8b 75 08             	mov    0x8(%ebp),%esi
  80088b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80088e:	89 f3                	mov    %esi,%ebx
  800890:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800893:	89 f0                	mov    %esi,%eax
  800895:	39 d8                	cmp    %ebx,%eax
  800897:	74 11                	je     8008aa <strncpy+0x2b>
		*dst++ = *src;
  800899:	83 c0 01             	add    $0x1,%eax
  80089c:	0f b6 0a             	movzbl (%edx),%ecx
  80089f:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  8008a2:	80 f9 01             	cmp    $0x1,%cl
  8008a5:	83 da ff             	sbb    $0xffffffff,%edx
  8008a8:	eb eb                	jmp    800895 <strncpy+0x16>
	}
	return ret;
}
  8008aa:	89 f0                	mov    %esi,%eax
  8008ac:	5b                   	pop    %ebx
  8008ad:	5e                   	pop    %esi
  8008ae:	5d                   	pop    %ebp
  8008af:	c3                   	ret    

008008b0 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  8008b0:	f3 0f 1e fb          	endbr32 
  8008b4:	55                   	push   %ebp
  8008b5:	89 e5                	mov    %esp,%ebp
  8008b7:	56                   	push   %esi
  8008b8:	53                   	push   %ebx
  8008b9:	8b 75 08             	mov    0x8(%ebp),%esi
  8008bc:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8008bf:	8b 55 10             	mov    0x10(%ebp),%edx
  8008c2:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  8008c4:	85 d2                	test   %edx,%edx
  8008c6:	74 21                	je     8008e9 <strlcpy+0x39>
  8008c8:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8008cc:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8008ce:	39 c2                	cmp    %eax,%edx
  8008d0:	74 14                	je     8008e6 <strlcpy+0x36>
  8008d2:	0f b6 19             	movzbl (%ecx),%ebx
  8008d5:	84 db                	test   %bl,%bl
  8008d7:	74 0b                	je     8008e4 <strlcpy+0x34>
			*dst++ = *src++;
  8008d9:	83 c1 01             	add    $0x1,%ecx
  8008dc:	83 c2 01             	add    $0x1,%edx
  8008df:	88 5a ff             	mov    %bl,-0x1(%edx)
  8008e2:	eb ea                	jmp    8008ce <strlcpy+0x1e>
  8008e4:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8008e6:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8008e9:	29 f0                	sub    %esi,%eax
}
  8008eb:	5b                   	pop    %ebx
  8008ec:	5e                   	pop    %esi
  8008ed:	5d                   	pop    %ebp
  8008ee:	c3                   	ret    

008008ef <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8008ef:	f3 0f 1e fb          	endbr32 
  8008f3:	55                   	push   %ebp
  8008f4:	89 e5                	mov    %esp,%ebp
  8008f6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008f9:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8008fc:	0f b6 01             	movzbl (%ecx),%eax
  8008ff:	84 c0                	test   %al,%al
  800901:	74 0c                	je     80090f <strcmp+0x20>
  800903:	3a 02                	cmp    (%edx),%al
  800905:	75 08                	jne    80090f <strcmp+0x20>
		p++, q++;
  800907:	83 c1 01             	add    $0x1,%ecx
  80090a:	83 c2 01             	add    $0x1,%edx
  80090d:	eb ed                	jmp    8008fc <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  80090f:	0f b6 c0             	movzbl %al,%eax
  800912:	0f b6 12             	movzbl (%edx),%edx
  800915:	29 d0                	sub    %edx,%eax
}
  800917:	5d                   	pop    %ebp
  800918:	c3                   	ret    

00800919 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800919:	f3 0f 1e fb          	endbr32 
  80091d:	55                   	push   %ebp
  80091e:	89 e5                	mov    %esp,%ebp
  800920:	53                   	push   %ebx
  800921:	8b 45 08             	mov    0x8(%ebp),%eax
  800924:	8b 55 0c             	mov    0xc(%ebp),%edx
  800927:	89 c3                	mov    %eax,%ebx
  800929:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  80092c:	eb 06                	jmp    800934 <strncmp+0x1b>
		n--, p++, q++;
  80092e:	83 c0 01             	add    $0x1,%eax
  800931:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800934:	39 d8                	cmp    %ebx,%eax
  800936:	74 16                	je     80094e <strncmp+0x35>
  800938:	0f b6 08             	movzbl (%eax),%ecx
  80093b:	84 c9                	test   %cl,%cl
  80093d:	74 04                	je     800943 <strncmp+0x2a>
  80093f:	3a 0a                	cmp    (%edx),%cl
  800941:	74 eb                	je     80092e <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800943:	0f b6 00             	movzbl (%eax),%eax
  800946:	0f b6 12             	movzbl (%edx),%edx
  800949:	29 d0                	sub    %edx,%eax
}
  80094b:	5b                   	pop    %ebx
  80094c:	5d                   	pop    %ebp
  80094d:	c3                   	ret    
		return 0;
  80094e:	b8 00 00 00 00       	mov    $0x0,%eax
  800953:	eb f6                	jmp    80094b <strncmp+0x32>

00800955 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800955:	f3 0f 1e fb          	endbr32 
  800959:	55                   	push   %ebp
  80095a:	89 e5                	mov    %esp,%ebp
  80095c:	8b 45 08             	mov    0x8(%ebp),%eax
  80095f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800963:	0f b6 10             	movzbl (%eax),%edx
  800966:	84 d2                	test   %dl,%dl
  800968:	74 09                	je     800973 <strchr+0x1e>
		if (*s == c)
  80096a:	38 ca                	cmp    %cl,%dl
  80096c:	74 0a                	je     800978 <strchr+0x23>
	for (; *s; s++)
  80096e:	83 c0 01             	add    $0x1,%eax
  800971:	eb f0                	jmp    800963 <strchr+0xe>
			return (char *) s;
	return 0;
  800973:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800978:	5d                   	pop    %ebp
  800979:	c3                   	ret    

0080097a <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  80097a:	f3 0f 1e fb          	endbr32 
  80097e:	55                   	push   %ebp
  80097f:	89 e5                	mov    %esp,%ebp
  800981:	8b 45 08             	mov    0x8(%ebp),%eax
  800984:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800988:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  80098b:	38 ca                	cmp    %cl,%dl
  80098d:	74 09                	je     800998 <strfind+0x1e>
  80098f:	84 d2                	test   %dl,%dl
  800991:	74 05                	je     800998 <strfind+0x1e>
	for (; *s; s++)
  800993:	83 c0 01             	add    $0x1,%eax
  800996:	eb f0                	jmp    800988 <strfind+0xe>
			break;
	return (char *) s;
}
  800998:	5d                   	pop    %ebp
  800999:	c3                   	ret    

0080099a <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  80099a:	f3 0f 1e fb          	endbr32 
  80099e:	55                   	push   %ebp
  80099f:	89 e5                	mov    %esp,%ebp
  8009a1:	57                   	push   %edi
  8009a2:	56                   	push   %esi
  8009a3:	53                   	push   %ebx
  8009a4:	8b 7d 08             	mov    0x8(%ebp),%edi
  8009a7:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  8009aa:	85 c9                	test   %ecx,%ecx
  8009ac:	74 31                	je     8009df <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  8009ae:	89 f8                	mov    %edi,%eax
  8009b0:	09 c8                	or     %ecx,%eax
  8009b2:	a8 03                	test   $0x3,%al
  8009b4:	75 23                	jne    8009d9 <memset+0x3f>
		c &= 0xFF;
  8009b6:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  8009ba:	89 d3                	mov    %edx,%ebx
  8009bc:	c1 e3 08             	shl    $0x8,%ebx
  8009bf:	89 d0                	mov    %edx,%eax
  8009c1:	c1 e0 18             	shl    $0x18,%eax
  8009c4:	89 d6                	mov    %edx,%esi
  8009c6:	c1 e6 10             	shl    $0x10,%esi
  8009c9:	09 f0                	or     %esi,%eax
  8009cb:	09 c2                	or     %eax,%edx
  8009cd:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  8009cf:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  8009d2:	89 d0                	mov    %edx,%eax
  8009d4:	fc                   	cld    
  8009d5:	f3 ab                	rep stos %eax,%es:(%edi)
  8009d7:	eb 06                	jmp    8009df <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  8009d9:	8b 45 0c             	mov    0xc(%ebp),%eax
  8009dc:	fc                   	cld    
  8009dd:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  8009df:	89 f8                	mov    %edi,%eax
  8009e1:	5b                   	pop    %ebx
  8009e2:	5e                   	pop    %esi
  8009e3:	5f                   	pop    %edi
  8009e4:	5d                   	pop    %ebp
  8009e5:	c3                   	ret    

008009e6 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009e6:	f3 0f 1e fb          	endbr32 
  8009ea:	55                   	push   %ebp
  8009eb:	89 e5                	mov    %esp,%ebp
  8009ed:	57                   	push   %edi
  8009ee:	56                   	push   %esi
  8009ef:	8b 45 08             	mov    0x8(%ebp),%eax
  8009f2:	8b 75 0c             	mov    0xc(%ebp),%esi
  8009f5:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  8009f8:	39 c6                	cmp    %eax,%esi
  8009fa:	73 32                	jae    800a2e <memmove+0x48>
  8009fc:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009ff:	39 c2                	cmp    %eax,%edx
  800a01:	76 2b                	jbe    800a2e <memmove+0x48>
		s += n;
		d += n;
  800a03:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a06:	89 fe                	mov    %edi,%esi
  800a08:	09 ce                	or     %ecx,%esi
  800a0a:	09 d6                	or     %edx,%esi
  800a0c:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800a12:	75 0e                	jne    800a22 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800a14:	83 ef 04             	sub    $0x4,%edi
  800a17:	8d 72 fc             	lea    -0x4(%edx),%esi
  800a1a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800a1d:	fd                   	std    
  800a1e:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a20:	eb 09                	jmp    800a2b <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800a22:	83 ef 01             	sub    $0x1,%edi
  800a25:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800a28:	fd                   	std    
  800a29:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800a2b:	fc                   	cld    
  800a2c:	eb 1a                	jmp    800a48 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a2e:	89 c2                	mov    %eax,%edx
  800a30:	09 ca                	or     %ecx,%edx
  800a32:	09 f2                	or     %esi,%edx
  800a34:	f6 c2 03             	test   $0x3,%dl
  800a37:	75 0a                	jne    800a43 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800a39:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800a3c:	89 c7                	mov    %eax,%edi
  800a3e:	fc                   	cld    
  800a3f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800a41:	eb 05                	jmp    800a48 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800a43:	89 c7                	mov    %eax,%edi
  800a45:	fc                   	cld    
  800a46:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a48:	5e                   	pop    %esi
  800a49:	5f                   	pop    %edi
  800a4a:	5d                   	pop    %ebp
  800a4b:	c3                   	ret    

00800a4c <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800a4c:	f3 0f 1e fb          	endbr32 
  800a50:	55                   	push   %ebp
  800a51:	89 e5                	mov    %esp,%ebp
  800a53:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a56:	ff 75 10             	pushl  0x10(%ebp)
  800a59:	ff 75 0c             	pushl  0xc(%ebp)
  800a5c:	ff 75 08             	pushl  0x8(%ebp)
  800a5f:	e8 82 ff ff ff       	call   8009e6 <memmove>
}
  800a64:	c9                   	leave  
  800a65:	c3                   	ret    

00800a66 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a66:	f3 0f 1e fb          	endbr32 
  800a6a:	55                   	push   %ebp
  800a6b:	89 e5                	mov    %esp,%ebp
  800a6d:	56                   	push   %esi
  800a6e:	53                   	push   %ebx
  800a6f:	8b 45 08             	mov    0x8(%ebp),%eax
  800a72:	8b 55 0c             	mov    0xc(%ebp),%edx
  800a75:	89 c6                	mov    %eax,%esi
  800a77:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a7a:	39 f0                	cmp    %esi,%eax
  800a7c:	74 1c                	je     800a9a <memcmp+0x34>
		if (*s1 != *s2)
  800a7e:	0f b6 08             	movzbl (%eax),%ecx
  800a81:	0f b6 1a             	movzbl (%edx),%ebx
  800a84:	38 d9                	cmp    %bl,%cl
  800a86:	75 08                	jne    800a90 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800a88:	83 c0 01             	add    $0x1,%eax
  800a8b:	83 c2 01             	add    $0x1,%edx
  800a8e:	eb ea                	jmp    800a7a <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a90:	0f b6 c1             	movzbl %cl,%eax
  800a93:	0f b6 db             	movzbl %bl,%ebx
  800a96:	29 d8                	sub    %ebx,%eax
  800a98:	eb 05                	jmp    800a9f <memcmp+0x39>
	}

	return 0;
  800a9a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a9f:	5b                   	pop    %ebx
  800aa0:	5e                   	pop    %esi
  800aa1:	5d                   	pop    %ebp
  800aa2:	c3                   	ret    

00800aa3 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800aa3:	f3 0f 1e fb          	endbr32 
  800aa7:	55                   	push   %ebp
  800aa8:	89 e5                	mov    %esp,%ebp
  800aaa:	8b 45 08             	mov    0x8(%ebp),%eax
  800aad:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800ab0:	89 c2                	mov    %eax,%edx
  800ab2:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800ab5:	39 d0                	cmp    %edx,%eax
  800ab7:	73 09                	jae    800ac2 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800ab9:	38 08                	cmp    %cl,(%eax)
  800abb:	74 05                	je     800ac2 <memfind+0x1f>
	for (; s < ends; s++)
  800abd:	83 c0 01             	add    $0x1,%eax
  800ac0:	eb f3                	jmp    800ab5 <memfind+0x12>
			break;
	return (void *) s;
}
  800ac2:	5d                   	pop    %ebp
  800ac3:	c3                   	ret    

00800ac4 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800ac4:	f3 0f 1e fb          	endbr32 
  800ac8:	55                   	push   %ebp
  800ac9:	89 e5                	mov    %esp,%ebp
  800acb:	57                   	push   %edi
  800acc:	56                   	push   %esi
  800acd:	53                   	push   %ebx
  800ace:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800ad1:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800ad4:	eb 03                	jmp    800ad9 <strtol+0x15>
		s++;
  800ad6:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800ad9:	0f b6 01             	movzbl (%ecx),%eax
  800adc:	3c 20                	cmp    $0x20,%al
  800ade:	74 f6                	je     800ad6 <strtol+0x12>
  800ae0:	3c 09                	cmp    $0x9,%al
  800ae2:	74 f2                	je     800ad6 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800ae4:	3c 2b                	cmp    $0x2b,%al
  800ae6:	74 2a                	je     800b12 <strtol+0x4e>
	int neg = 0;
  800ae8:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800aed:	3c 2d                	cmp    $0x2d,%al
  800aef:	74 2b                	je     800b1c <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800af1:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800af7:	75 0f                	jne    800b08 <strtol+0x44>
  800af9:	80 39 30             	cmpb   $0x30,(%ecx)
  800afc:	74 28                	je     800b26 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800afe:	85 db                	test   %ebx,%ebx
  800b00:	b8 0a 00 00 00       	mov    $0xa,%eax
  800b05:	0f 44 d8             	cmove  %eax,%ebx
  800b08:	b8 00 00 00 00       	mov    $0x0,%eax
  800b0d:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800b10:	eb 46                	jmp    800b58 <strtol+0x94>
		s++;
  800b12:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800b15:	bf 00 00 00 00       	mov    $0x0,%edi
  800b1a:	eb d5                	jmp    800af1 <strtol+0x2d>
		s++, neg = 1;
  800b1c:	83 c1 01             	add    $0x1,%ecx
  800b1f:	bf 01 00 00 00       	mov    $0x1,%edi
  800b24:	eb cb                	jmp    800af1 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b26:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800b2a:	74 0e                	je     800b3a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800b2c:	85 db                	test   %ebx,%ebx
  800b2e:	75 d8                	jne    800b08 <strtol+0x44>
		s++, base = 8;
  800b30:	83 c1 01             	add    $0x1,%ecx
  800b33:	bb 08 00 00 00       	mov    $0x8,%ebx
  800b38:	eb ce                	jmp    800b08 <strtol+0x44>
		s += 2, base = 16;
  800b3a:	83 c1 02             	add    $0x2,%ecx
  800b3d:	bb 10 00 00 00       	mov    $0x10,%ebx
  800b42:	eb c4                	jmp    800b08 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800b44:	0f be d2             	movsbl %dl,%edx
  800b47:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800b4a:	3b 55 10             	cmp    0x10(%ebp),%edx
  800b4d:	7d 3a                	jge    800b89 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800b4f:	83 c1 01             	add    $0x1,%ecx
  800b52:	0f af 45 10          	imul   0x10(%ebp),%eax
  800b56:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800b58:	0f b6 11             	movzbl (%ecx),%edx
  800b5b:	8d 72 d0             	lea    -0x30(%edx),%esi
  800b5e:	89 f3                	mov    %esi,%ebx
  800b60:	80 fb 09             	cmp    $0x9,%bl
  800b63:	76 df                	jbe    800b44 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800b65:	8d 72 9f             	lea    -0x61(%edx),%esi
  800b68:	89 f3                	mov    %esi,%ebx
  800b6a:	80 fb 19             	cmp    $0x19,%bl
  800b6d:	77 08                	ja     800b77 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800b6f:	0f be d2             	movsbl %dl,%edx
  800b72:	83 ea 57             	sub    $0x57,%edx
  800b75:	eb d3                	jmp    800b4a <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800b77:	8d 72 bf             	lea    -0x41(%edx),%esi
  800b7a:	89 f3                	mov    %esi,%ebx
  800b7c:	80 fb 19             	cmp    $0x19,%bl
  800b7f:	77 08                	ja     800b89 <strtol+0xc5>
			dig = *s - 'A' + 10;
  800b81:	0f be d2             	movsbl %dl,%edx
  800b84:	83 ea 37             	sub    $0x37,%edx
  800b87:	eb c1                	jmp    800b4a <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800b89:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800b8d:	74 05                	je     800b94 <strtol+0xd0>
		*endptr = (char *) s;
  800b8f:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b92:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b94:	89 c2                	mov    %eax,%edx
  800b96:	f7 da                	neg    %edx
  800b98:	85 ff                	test   %edi,%edi
  800b9a:	0f 45 c2             	cmovne %edx,%eax
}
  800b9d:	5b                   	pop    %ebx
  800b9e:	5e                   	pop    %esi
  800b9f:	5f                   	pop    %edi
  800ba0:	5d                   	pop    %ebp
  800ba1:	c3                   	ret    

00800ba2 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800ba2:	f3 0f 1e fb          	endbr32 
  800ba6:	55                   	push   %ebp
  800ba7:	89 e5                	mov    %esp,%ebp
  800ba9:	57                   	push   %edi
  800baa:	56                   	push   %esi
  800bab:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bac:	b8 00 00 00 00       	mov    $0x0,%eax
  800bb1:	8b 55 08             	mov    0x8(%ebp),%edx
  800bb4:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800bb7:	89 c3                	mov    %eax,%ebx
  800bb9:	89 c7                	mov    %eax,%edi
  800bbb:	89 c6                	mov    %eax,%esi
  800bbd:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800bbf:	5b                   	pop    %ebx
  800bc0:	5e                   	pop    %esi
  800bc1:	5f                   	pop    %edi
  800bc2:	5d                   	pop    %ebp
  800bc3:	c3                   	ret    

00800bc4 <sys_cgetc>:

int
sys_cgetc(void)
{
  800bc4:	f3 0f 1e fb          	endbr32 
  800bc8:	55                   	push   %ebp
  800bc9:	89 e5                	mov    %esp,%ebp
  800bcb:	57                   	push   %edi
  800bcc:	56                   	push   %esi
  800bcd:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bce:	ba 00 00 00 00       	mov    $0x0,%edx
  800bd3:	b8 01 00 00 00       	mov    $0x1,%eax
  800bd8:	89 d1                	mov    %edx,%ecx
  800bda:	89 d3                	mov    %edx,%ebx
  800bdc:	89 d7                	mov    %edx,%edi
  800bde:	89 d6                	mov    %edx,%esi
  800be0:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800be2:	5b                   	pop    %ebx
  800be3:	5e                   	pop    %esi
  800be4:	5f                   	pop    %edi
  800be5:	5d                   	pop    %ebp
  800be6:	c3                   	ret    

00800be7 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800be7:	f3 0f 1e fb          	endbr32 
  800beb:	55                   	push   %ebp
  800bec:	89 e5                	mov    %esp,%ebp
  800bee:	57                   	push   %edi
  800bef:	56                   	push   %esi
  800bf0:	53                   	push   %ebx
  800bf1:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bf4:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bf9:	8b 55 08             	mov    0x8(%ebp),%edx
  800bfc:	b8 03 00 00 00       	mov    $0x3,%eax
  800c01:	89 cb                	mov    %ecx,%ebx
  800c03:	89 cf                	mov    %ecx,%edi
  800c05:	89 ce                	mov    %ecx,%esi
  800c07:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c09:	85 c0                	test   %eax,%eax
  800c0b:	7f 08                	jg     800c15 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800c0d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c10:	5b                   	pop    %ebx
  800c11:	5e                   	pop    %esi
  800c12:	5f                   	pop    %edi
  800c13:	5d                   	pop    %ebp
  800c14:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c15:	83 ec 0c             	sub    $0xc,%esp
  800c18:	50                   	push   %eax
  800c19:	6a 03                	push   $0x3
  800c1b:	68 bf 26 80 00       	push   $0x8026bf
  800c20:	6a 23                	push   $0x23
  800c22:	68 dc 26 80 00       	push   $0x8026dc
  800c27:	e8 44 f5 ff ff       	call   800170 <_panic>

00800c2c <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800c2c:	f3 0f 1e fb          	endbr32 
  800c30:	55                   	push   %ebp
  800c31:	89 e5                	mov    %esp,%ebp
  800c33:	57                   	push   %edi
  800c34:	56                   	push   %esi
  800c35:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c36:	ba 00 00 00 00       	mov    $0x0,%edx
  800c3b:	b8 02 00 00 00       	mov    $0x2,%eax
  800c40:	89 d1                	mov    %edx,%ecx
  800c42:	89 d3                	mov    %edx,%ebx
  800c44:	89 d7                	mov    %edx,%edi
  800c46:	89 d6                	mov    %edx,%esi
  800c48:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800c4a:	5b                   	pop    %ebx
  800c4b:	5e                   	pop    %esi
  800c4c:	5f                   	pop    %edi
  800c4d:	5d                   	pop    %ebp
  800c4e:	c3                   	ret    

00800c4f <sys_yield>:

void
sys_yield(void)
{
  800c4f:	f3 0f 1e fb          	endbr32 
  800c53:	55                   	push   %ebp
  800c54:	89 e5                	mov    %esp,%ebp
  800c56:	57                   	push   %edi
  800c57:	56                   	push   %esi
  800c58:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c59:	ba 00 00 00 00       	mov    $0x0,%edx
  800c5e:	b8 0b 00 00 00       	mov    $0xb,%eax
  800c63:	89 d1                	mov    %edx,%ecx
  800c65:	89 d3                	mov    %edx,%ebx
  800c67:	89 d7                	mov    %edx,%edi
  800c69:	89 d6                	mov    %edx,%esi
  800c6b:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800c6d:	5b                   	pop    %ebx
  800c6e:	5e                   	pop    %esi
  800c6f:	5f                   	pop    %edi
  800c70:	5d                   	pop    %ebp
  800c71:	c3                   	ret    

00800c72 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800c72:	f3 0f 1e fb          	endbr32 
  800c76:	55                   	push   %ebp
  800c77:	89 e5                	mov    %esp,%ebp
  800c79:	57                   	push   %edi
  800c7a:	56                   	push   %esi
  800c7b:	53                   	push   %ebx
  800c7c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c7f:	be 00 00 00 00       	mov    $0x0,%esi
  800c84:	8b 55 08             	mov    0x8(%ebp),%edx
  800c87:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c8a:	b8 04 00 00 00       	mov    $0x4,%eax
  800c8f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c92:	89 f7                	mov    %esi,%edi
  800c94:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c96:	85 c0                	test   %eax,%eax
  800c98:	7f 08                	jg     800ca2 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c9a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c9d:	5b                   	pop    %ebx
  800c9e:	5e                   	pop    %esi
  800c9f:	5f                   	pop    %edi
  800ca0:	5d                   	pop    %ebp
  800ca1:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ca2:	83 ec 0c             	sub    $0xc,%esp
  800ca5:	50                   	push   %eax
  800ca6:	6a 04                	push   $0x4
  800ca8:	68 bf 26 80 00       	push   $0x8026bf
  800cad:	6a 23                	push   $0x23
  800caf:	68 dc 26 80 00       	push   $0x8026dc
  800cb4:	e8 b7 f4 ff ff       	call   800170 <_panic>

00800cb9 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800cb9:	f3 0f 1e fb          	endbr32 
  800cbd:	55                   	push   %ebp
  800cbe:	89 e5                	mov    %esp,%ebp
  800cc0:	57                   	push   %edi
  800cc1:	56                   	push   %esi
  800cc2:	53                   	push   %ebx
  800cc3:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cc6:	8b 55 08             	mov    0x8(%ebp),%edx
  800cc9:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ccc:	b8 05 00 00 00       	mov    $0x5,%eax
  800cd1:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800cd4:	8b 7d 14             	mov    0x14(%ebp),%edi
  800cd7:	8b 75 18             	mov    0x18(%ebp),%esi
  800cda:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cdc:	85 c0                	test   %eax,%eax
  800cde:	7f 08                	jg     800ce8 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800ce0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce3:	5b                   	pop    %ebx
  800ce4:	5e                   	pop    %esi
  800ce5:	5f                   	pop    %edi
  800ce6:	5d                   	pop    %ebp
  800ce7:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ce8:	83 ec 0c             	sub    $0xc,%esp
  800ceb:	50                   	push   %eax
  800cec:	6a 05                	push   $0x5
  800cee:	68 bf 26 80 00       	push   $0x8026bf
  800cf3:	6a 23                	push   $0x23
  800cf5:	68 dc 26 80 00       	push   $0x8026dc
  800cfa:	e8 71 f4 ff ff       	call   800170 <_panic>

00800cff <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800cff:	f3 0f 1e fb          	endbr32 
  800d03:	55                   	push   %ebp
  800d04:	89 e5                	mov    %esp,%ebp
  800d06:	57                   	push   %edi
  800d07:	56                   	push   %esi
  800d08:	53                   	push   %ebx
  800d09:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d0c:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d11:	8b 55 08             	mov    0x8(%ebp),%edx
  800d14:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d17:	b8 06 00 00 00       	mov    $0x6,%eax
  800d1c:	89 df                	mov    %ebx,%edi
  800d1e:	89 de                	mov    %ebx,%esi
  800d20:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d22:	85 c0                	test   %eax,%eax
  800d24:	7f 08                	jg     800d2e <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800d26:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d29:	5b                   	pop    %ebx
  800d2a:	5e                   	pop    %esi
  800d2b:	5f                   	pop    %edi
  800d2c:	5d                   	pop    %ebp
  800d2d:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d2e:	83 ec 0c             	sub    $0xc,%esp
  800d31:	50                   	push   %eax
  800d32:	6a 06                	push   $0x6
  800d34:	68 bf 26 80 00       	push   $0x8026bf
  800d39:	6a 23                	push   $0x23
  800d3b:	68 dc 26 80 00       	push   $0x8026dc
  800d40:	e8 2b f4 ff ff       	call   800170 <_panic>

00800d45 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800d45:	f3 0f 1e fb          	endbr32 
  800d49:	55                   	push   %ebp
  800d4a:	89 e5                	mov    %esp,%ebp
  800d4c:	57                   	push   %edi
  800d4d:	56                   	push   %esi
  800d4e:	53                   	push   %ebx
  800d4f:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d52:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d57:	8b 55 08             	mov    0x8(%ebp),%edx
  800d5a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d5d:	b8 08 00 00 00       	mov    $0x8,%eax
  800d62:	89 df                	mov    %ebx,%edi
  800d64:	89 de                	mov    %ebx,%esi
  800d66:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d68:	85 c0                	test   %eax,%eax
  800d6a:	7f 08                	jg     800d74 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800d6c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d6f:	5b                   	pop    %ebx
  800d70:	5e                   	pop    %esi
  800d71:	5f                   	pop    %edi
  800d72:	5d                   	pop    %ebp
  800d73:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d74:	83 ec 0c             	sub    $0xc,%esp
  800d77:	50                   	push   %eax
  800d78:	6a 08                	push   $0x8
  800d7a:	68 bf 26 80 00       	push   $0x8026bf
  800d7f:	6a 23                	push   $0x23
  800d81:	68 dc 26 80 00       	push   $0x8026dc
  800d86:	e8 e5 f3 ff ff       	call   800170 <_panic>

00800d8b <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800d8b:	f3 0f 1e fb          	endbr32 
  800d8f:	55                   	push   %ebp
  800d90:	89 e5                	mov    %esp,%ebp
  800d92:	57                   	push   %edi
  800d93:	56                   	push   %esi
  800d94:	53                   	push   %ebx
  800d95:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d98:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d9d:	8b 55 08             	mov    0x8(%ebp),%edx
  800da0:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da3:	b8 09 00 00 00       	mov    $0x9,%eax
  800da8:	89 df                	mov    %ebx,%edi
  800daa:	89 de                	mov    %ebx,%esi
  800dac:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dae:	85 c0                	test   %eax,%eax
  800db0:	7f 08                	jg     800dba <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800db2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800db5:	5b                   	pop    %ebx
  800db6:	5e                   	pop    %esi
  800db7:	5f                   	pop    %edi
  800db8:	5d                   	pop    %ebp
  800db9:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dba:	83 ec 0c             	sub    $0xc,%esp
  800dbd:	50                   	push   %eax
  800dbe:	6a 09                	push   $0x9
  800dc0:	68 bf 26 80 00       	push   $0x8026bf
  800dc5:	6a 23                	push   $0x23
  800dc7:	68 dc 26 80 00       	push   $0x8026dc
  800dcc:	e8 9f f3 ff ff       	call   800170 <_panic>

00800dd1 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800dd1:	f3 0f 1e fb          	endbr32 
  800dd5:	55                   	push   %ebp
  800dd6:	89 e5                	mov    %esp,%ebp
  800dd8:	57                   	push   %edi
  800dd9:	56                   	push   %esi
  800dda:	53                   	push   %ebx
  800ddb:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dde:	bb 00 00 00 00       	mov    $0x0,%ebx
  800de3:	8b 55 08             	mov    0x8(%ebp),%edx
  800de6:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800de9:	b8 0a 00 00 00       	mov    $0xa,%eax
  800dee:	89 df                	mov    %ebx,%edi
  800df0:	89 de                	mov    %ebx,%esi
  800df2:	cd 30                	int    $0x30
	if(check && ret > 0)
  800df4:	85 c0                	test   %eax,%eax
  800df6:	7f 08                	jg     800e00 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800df8:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dfb:	5b                   	pop    %ebx
  800dfc:	5e                   	pop    %esi
  800dfd:	5f                   	pop    %edi
  800dfe:	5d                   	pop    %ebp
  800dff:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e00:	83 ec 0c             	sub    $0xc,%esp
  800e03:	50                   	push   %eax
  800e04:	6a 0a                	push   $0xa
  800e06:	68 bf 26 80 00       	push   $0x8026bf
  800e0b:	6a 23                	push   $0x23
  800e0d:	68 dc 26 80 00       	push   $0x8026dc
  800e12:	e8 59 f3 ff ff       	call   800170 <_panic>

00800e17 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800e17:	f3 0f 1e fb          	endbr32 
  800e1b:	55                   	push   %ebp
  800e1c:	89 e5                	mov    %esp,%ebp
  800e1e:	57                   	push   %edi
  800e1f:	56                   	push   %esi
  800e20:	53                   	push   %ebx
	asm volatile("int %1\n"
  800e21:	8b 55 08             	mov    0x8(%ebp),%edx
  800e24:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e27:	b8 0c 00 00 00       	mov    $0xc,%eax
  800e2c:	be 00 00 00 00       	mov    $0x0,%esi
  800e31:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800e34:	8b 7d 14             	mov    0x14(%ebp),%edi
  800e37:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800e39:	5b                   	pop    %ebx
  800e3a:	5e                   	pop    %esi
  800e3b:	5f                   	pop    %edi
  800e3c:	5d                   	pop    %ebp
  800e3d:	c3                   	ret    

00800e3e <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800e3e:	f3 0f 1e fb          	endbr32 
  800e42:	55                   	push   %ebp
  800e43:	89 e5                	mov    %esp,%ebp
  800e45:	57                   	push   %edi
  800e46:	56                   	push   %esi
  800e47:	53                   	push   %ebx
  800e48:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e4b:	b9 00 00 00 00       	mov    $0x0,%ecx
  800e50:	8b 55 08             	mov    0x8(%ebp),%edx
  800e53:	b8 0d 00 00 00       	mov    $0xd,%eax
  800e58:	89 cb                	mov    %ecx,%ebx
  800e5a:	89 cf                	mov    %ecx,%edi
  800e5c:	89 ce                	mov    %ecx,%esi
  800e5e:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e60:	85 c0                	test   %eax,%eax
  800e62:	7f 08                	jg     800e6c <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800e64:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e67:	5b                   	pop    %ebx
  800e68:	5e                   	pop    %esi
  800e69:	5f                   	pop    %edi
  800e6a:	5d                   	pop    %ebp
  800e6b:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e6c:	83 ec 0c             	sub    $0xc,%esp
  800e6f:	50                   	push   %eax
  800e70:	6a 0d                	push   $0xd
  800e72:	68 bf 26 80 00       	push   $0x8026bf
  800e77:	6a 23                	push   $0x23
  800e79:	68 dc 26 80 00       	push   $0x8026dc
  800e7e:	e8 ed f2 ff ff       	call   800170 <_panic>

00800e83 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800e83:	f3 0f 1e fb          	endbr32 
  800e87:	55                   	push   %ebp
  800e88:	89 e5                	mov    %esp,%ebp
  800e8a:	56                   	push   %esi
  800e8b:	53                   	push   %ebx
  800e8c:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e8f:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e91:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e95:	0f 84 b2 00 00 00    	je     800f4d <pgfault+0xca>
  800e9b:	89 d8                	mov    %ebx,%eax
  800e9d:	c1 e8 16             	shr    $0x16,%eax
  800ea0:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800ea7:	a8 01                	test   $0x1,%al
  800ea9:	0f 84 9e 00 00 00    	je     800f4d <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800eaf:	89 d8                	mov    %ebx,%eax
  800eb1:	c1 e8 0c             	shr    $0xc,%eax
  800eb4:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800ebb:	f6 c2 01             	test   $0x1,%dl
  800ebe:	0f 84 89 00 00 00    	je     800f4d <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800ec4:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800ecb:	f6 c4 08             	test   $0x8,%ah
  800ece:	74 7d                	je     800f4d <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800ed0:	e8 57 fd ff ff       	call   800c2c <sys_getenvid>
  800ed5:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800ed7:	83 ec 04             	sub    $0x4,%esp
  800eda:	6a 07                	push   $0x7
  800edc:	68 00 f0 7f 00       	push   $0x7ff000
  800ee1:	50                   	push   %eax
  800ee2:	e8 8b fd ff ff       	call   800c72 <sys_page_alloc>
	if(r<0){
  800ee7:	83 c4 10             	add    $0x10,%esp
  800eea:	85 c0                	test   %eax,%eax
  800eec:	78 73                	js     800f61 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800eee:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800ef4:	83 ec 04             	sub    $0x4,%esp
  800ef7:	68 00 10 00 00       	push   $0x1000
  800efc:	53                   	push   %ebx
  800efd:	68 00 f0 7f 00       	push   $0x7ff000
  800f02:	e8 df fa ff ff       	call   8009e6 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800f07:	83 c4 08             	add    $0x8,%esp
  800f0a:	53                   	push   %ebx
  800f0b:	56                   	push   %esi
  800f0c:	e8 ee fd ff ff       	call   800cff <sys_page_unmap>
	if(r<0)
  800f11:	83 c4 10             	add    $0x10,%esp
  800f14:	85 c0                	test   %eax,%eax
  800f16:	78 5b                	js     800f73 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800f18:	83 ec 0c             	sub    $0xc,%esp
  800f1b:	6a 07                	push   $0x7
  800f1d:	53                   	push   %ebx
  800f1e:	56                   	push   %esi
  800f1f:	68 00 f0 7f 00       	push   $0x7ff000
  800f24:	56                   	push   %esi
  800f25:	e8 8f fd ff ff       	call   800cb9 <sys_page_map>
	if(r<0)
  800f2a:	83 c4 20             	add    $0x20,%esp
  800f2d:	85 c0                	test   %eax,%eax
  800f2f:	78 54                	js     800f85 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800f31:	83 ec 08             	sub    $0x8,%esp
  800f34:	68 00 f0 7f 00       	push   $0x7ff000
  800f39:	56                   	push   %esi
  800f3a:	e8 c0 fd ff ff       	call   800cff <sys_page_unmap>
	if(r<0)
  800f3f:	83 c4 10             	add    $0x10,%esp
  800f42:	85 c0                	test   %eax,%eax
  800f44:	78 51                	js     800f97 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800f46:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800f49:	5b                   	pop    %ebx
  800f4a:	5e                   	pop    %esi
  800f4b:	5d                   	pop    %ebp
  800f4c:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800f4d:	83 ec 04             	sub    $0x4,%esp
  800f50:	68 ec 26 80 00       	push   $0x8026ec
  800f55:	6a 2c                	push   $0x2c
  800f57:	68 9b 27 80 00       	push   $0x80279b
  800f5c:	e8 0f f2 ff ff       	call   800170 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800f61:	50                   	push   %eax
  800f62:	68 2c 27 80 00       	push   $0x80272c
  800f67:	6a 31                	push   $0x31
  800f69:	68 9b 27 80 00       	push   $0x80279b
  800f6e:	e8 fd f1 ff ff       	call   800170 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f73:	50                   	push   %eax
  800f74:	68 a6 27 80 00       	push   $0x8027a6
  800f79:	6a 3b                	push   $0x3b
  800f7b:	68 9b 27 80 00       	push   $0x80279b
  800f80:	e8 eb f1 ff ff       	call   800170 <_panic>
	panic("pgfault: page map failed %e", r);
  800f85:	50                   	push   %eax
  800f86:	68 c4 27 80 00       	push   $0x8027c4
  800f8b:	6a 3e                	push   $0x3e
  800f8d:	68 9b 27 80 00       	push   $0x80279b
  800f92:	e8 d9 f1 ff ff       	call   800170 <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f97:	50                   	push   %eax
  800f98:	68 a6 27 80 00       	push   $0x8027a6
  800f9d:	6a 41                	push   $0x41
  800f9f:	68 9b 27 80 00       	push   $0x80279b
  800fa4:	e8 c7 f1 ff ff       	call   800170 <_panic>

00800fa9 <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800fa9:	f3 0f 1e fb          	endbr32 
  800fad:	55                   	push   %ebp
  800fae:	89 e5                	mov    %esp,%ebp
  800fb0:	57                   	push   %edi
  800fb1:	56                   	push   %esi
  800fb2:	53                   	push   %ebx
  800fb3:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800fb6:	68 83 0e 80 00       	push   $0x800e83
  800fbb:	e8 5f 10 00 00       	call   80201f <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800fc0:	b8 07 00 00 00       	mov    $0x7,%eax
  800fc5:	cd 30                	int    $0x30
  800fc7:	89 c7                	mov    %eax,%edi
  800fc9:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800fcc:	83 c4 10             	add    $0x10,%esp
  800fcf:	85 c0                	test   %eax,%eax
  800fd1:	0f 8e 9d 01 00 00    	jle    801174 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800fd7:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800fdc:	eb 5b                	jmp    801039 <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800fde:	83 ec 0c             	sub    $0xc,%esp
  800fe1:	68 07 0e 00 00       	push   $0xe07
  800fe6:	56                   	push   %esi
  800fe7:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fea:	56                   	push   %esi
  800feb:	6a 00                	push   $0x0
  800fed:	e8 c7 fc ff ff       	call   800cb9 <sys_page_map>
  800ff2:	83 c4 20             	add    $0x20,%esp
  800ff5:	eb 30                	jmp    801027 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800ff7:	83 ec 04             	sub    $0x4,%esp
  800ffa:	68 e0 27 80 00       	push   $0x8027e0
  800fff:	6a 63                	push   $0x63
  801001:	68 9b 27 80 00       	push   $0x80279b
  801006:	e8 65 f1 ff ff       	call   800170 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  80100b:	83 ec 0c             	sub    $0xc,%esp
  80100e:	6a 05                	push   $0x5
  801010:	56                   	push   %esi
  801011:	ff 75 e4             	pushl  -0x1c(%ebp)
  801014:	56                   	push   %esi
  801015:	6a 00                	push   $0x0
  801017:	e8 9d fc ff ff       	call   800cb9 <sys_page_map>
            if(r < 0)
  80101c:	83 c4 20             	add    $0x20,%esp
  80101f:	85 c0                	test   %eax,%eax
  801021:	0f 88 ac 00 00 00    	js     8010d3 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  801027:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  80102d:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  801033:	0f 84 ae 00 00 00    	je     8010e7 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801039:	89 d8                	mov    %ebx,%eax
  80103b:	c1 e8 16             	shr    $0x16,%eax
  80103e:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801045:	a8 01                	test   $0x1,%al
  801047:	74 de                	je     801027 <fork+0x7e>
			pn=PGNUM(pageVa);
  801049:	89 d8                	mov    %ebx,%eax
  80104b:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  80104e:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801055:	f6 c2 01             	test   $0x1,%dl
  801058:	74 cd                	je     801027 <fork+0x7e>
  80105a:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801061:	f6 c2 04             	test   $0x4,%dl
  801064:	74 c1                	je     801027 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  801066:	89 c6                	mov    %eax,%esi
  801068:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  80106b:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801072:	f6 c4 04             	test   $0x4,%ah
  801075:	0f 85 63 ff ff ff    	jne    800fde <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  80107b:	a9 02 08 00 00       	test   $0x802,%eax
  801080:	74 89                	je     80100b <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801082:	83 ec 0c             	sub    $0xc,%esp
  801085:	68 05 08 00 00       	push   $0x805
  80108a:	56                   	push   %esi
  80108b:	ff 75 e4             	pushl  -0x1c(%ebp)
  80108e:	56                   	push   %esi
  80108f:	6a 00                	push   $0x0
  801091:	e8 23 fc ff ff       	call   800cb9 <sys_page_map>
            if(r < 0)
  801096:	83 c4 20             	add    $0x20,%esp
  801099:	85 c0                	test   %eax,%eax
  80109b:	0f 88 56 ff ff ff    	js     800ff7 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  8010a1:	83 ec 0c             	sub    $0xc,%esp
  8010a4:	68 05 08 00 00       	push   $0x805
  8010a9:	56                   	push   %esi
  8010aa:	6a 00                	push   $0x0
  8010ac:	56                   	push   %esi
  8010ad:	6a 00                	push   $0x0
  8010af:	e8 05 fc ff ff       	call   800cb9 <sys_page_map>
            if(r < 0)
  8010b4:	83 c4 20             	add    $0x20,%esp
  8010b7:	85 c0                	test   %eax,%eax
  8010b9:	0f 89 68 ff ff ff    	jns    801027 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8010bf:	83 ec 04             	sub    $0x4,%esp
  8010c2:	68 e0 27 80 00       	push   $0x8027e0
  8010c7:	6a 66                	push   $0x66
  8010c9:	68 9b 27 80 00       	push   $0x80279b
  8010ce:	e8 9d f0 ff ff       	call   800170 <_panic>
                panic("duppage: sys_page_map fail\n");
  8010d3:	83 ec 04             	sub    $0x4,%esp
  8010d6:	68 e0 27 80 00       	push   $0x8027e0
  8010db:	6a 6c                	push   $0x6c
  8010dd:	68 9b 27 80 00       	push   $0x80279b
  8010e2:	e8 89 f0 ff ff       	call   800170 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8010e7:	83 ec 04             	sub    $0x4,%esp
  8010ea:	6a 07                	push   $0x7
  8010ec:	68 00 f0 bf ee       	push   $0xeebff000
  8010f1:	57                   	push   %edi
  8010f2:	e8 7b fb ff ff       	call   800c72 <sys_page_alloc>
		if(flag<0){
  8010f7:	83 c4 10             	add    $0x10,%esp
  8010fa:	85 c0                	test   %eax,%eax
  8010fc:	78 31                	js     80112f <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8010fe:	83 ec 08             	sub    $0x8,%esp
  801101:	68 99 20 80 00       	push   $0x802099
  801106:	57                   	push   %edi
  801107:	e8 c5 fc ff ff       	call   800dd1 <sys_env_set_pgfault_upcall>
		if(flag<0){
  80110c:	83 c4 10             	add    $0x10,%esp
  80110f:	85 c0                	test   %eax,%eax
  801111:	78 33                	js     801146 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  801113:	83 ec 08             	sub    $0x8,%esp
  801116:	6a 02                	push   $0x2
  801118:	57                   	push   %edi
  801119:	e8 27 fc ff ff       	call   800d45 <sys_env_set_status>
		if(flag<0){
  80111e:	83 c4 10             	add    $0x10,%esp
  801121:	85 c0                	test   %eax,%eax
  801123:	78 38                	js     80115d <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  801125:	89 f8                	mov    %edi,%eax
  801127:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80112a:	5b                   	pop    %ebx
  80112b:	5e                   	pop    %esi
  80112c:	5f                   	pop    %edi
  80112d:	5d                   	pop    %ebp
  80112e:	c3                   	ret    
			panic("panic by alloc page");
  80112f:	83 ec 04             	sub    $0x4,%esp
  801132:	68 fc 27 80 00       	push   $0x8027fc
  801137:	68 98 00 00 00       	push   $0x98
  80113c:	68 9b 27 80 00       	push   $0x80279b
  801141:	e8 2a f0 ff ff       	call   800170 <_panic>
			panic("panic by set pgfault upcall faction");
  801146:	83 ec 04             	sub    $0x4,%esp
  801149:	68 50 27 80 00       	push   $0x802750
  80114e:	68 9e 00 00 00       	push   $0x9e
  801153:	68 9b 27 80 00       	push   $0x80279b
  801158:	e8 13 f0 ff ff       	call   800170 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  80115d:	83 ec 04             	sub    $0x4,%esp
  801160:	68 74 27 80 00       	push   $0x802774
  801165:	68 a3 00 00 00       	push   $0xa3
  80116a:	68 9b 27 80 00       	push   $0x80279b
  80116f:	e8 fc ef ff ff       	call   800170 <_panic>
	else if(envid==0){
  801174:	75 19                	jne    80118f <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  801176:	e8 b1 fa ff ff       	call   800c2c <sys_getenvid>
  80117b:	25 ff 03 00 00       	and    $0x3ff,%eax
  801180:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801183:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  801188:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  80118d:	eb 96                	jmp    801125 <fork+0x17c>
		panic("panic by alloc envid");
  80118f:	83 ec 04             	sub    $0x4,%esp
  801192:	68 10 28 80 00       	push   $0x802810
  801197:	68 ad 00 00 00       	push   $0xad
  80119c:	68 9b 27 80 00       	push   $0x80279b
  8011a1:	e8 ca ef ff ff       	call   800170 <_panic>

008011a6 <sfork>:

// Challenge!
int
sfork(void)
{
  8011a6:	f3 0f 1e fb          	endbr32 
  8011aa:	55                   	push   %ebp
  8011ab:	89 e5                	mov    %esp,%ebp
  8011ad:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  8011b0:	68 25 28 80 00       	push   $0x802825
  8011b5:	68 b7 00 00 00       	push   $0xb7
  8011ba:	68 9b 27 80 00       	push   $0x80279b
  8011bf:	e8 ac ef ff ff       	call   800170 <_panic>

008011c4 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  8011c4:	f3 0f 1e fb          	endbr32 
  8011c8:	55                   	push   %ebp
  8011c9:	89 e5                	mov    %esp,%ebp
  8011cb:	56                   	push   %esi
  8011cc:	53                   	push   %ebx
  8011cd:	8b 75 08             	mov    0x8(%ebp),%esi
  8011d0:	8b 45 0c             	mov    0xc(%ebp),%eax
  8011d3:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  8011d6:	85 c0                	test   %eax,%eax
  8011d8:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  8011dd:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  8011e0:	83 ec 0c             	sub    $0xc,%esp
  8011e3:	50                   	push   %eax
  8011e4:	e8 55 fc ff ff       	call   800e3e <sys_ipc_recv>
  8011e9:	83 c4 10             	add    $0x10,%esp
  8011ec:	85 c0                	test   %eax,%eax
  8011ee:	78 3f                	js     80122f <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  8011f0:	e8 37 fa ff ff       	call   800c2c <sys_getenvid>
  8011f5:	25 ff 03 00 00       	and    $0x3ff,%eax
  8011fa:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8011fd:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801203:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801209:	85 f6                	test   %esi,%esi
  80120b:	74 05                	je     801212 <ipc_recv+0x4e>
  80120d:	8b 42 74             	mov    0x74(%edx),%eax
  801210:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801212:	85 db                	test   %ebx,%ebx
  801214:	74 0a                	je     801220 <ipc_recv+0x5c>
  801216:	a1 04 40 80 00       	mov    0x804004,%eax
  80121b:	8b 40 78             	mov    0x78(%eax),%eax
  80121e:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801220:	a1 04 40 80 00       	mov    0x804004,%eax
  801225:	8b 40 70             	mov    0x70(%eax),%eax
}
  801228:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80122b:	5b                   	pop    %ebx
  80122c:	5e                   	pop    %esi
  80122d:	5d                   	pop    %ebp
  80122e:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  80122f:	85 f6                	test   %esi,%esi
  801231:	74 06                	je     801239 <ipc_recv+0x75>
  801233:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801239:	85 db                	test   %ebx,%ebx
  80123b:	74 eb                	je     801228 <ipc_recv+0x64>
  80123d:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801243:	eb e3                	jmp    801228 <ipc_recv+0x64>

00801245 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801245:	f3 0f 1e fb          	endbr32 
  801249:	55                   	push   %ebp
  80124a:	89 e5                	mov    %esp,%ebp
  80124c:	57                   	push   %edi
  80124d:	56                   	push   %esi
  80124e:	53                   	push   %ebx
  80124f:	83 ec 0c             	sub    $0xc,%esp
  801252:	8b 7d 08             	mov    0x8(%ebp),%edi
  801255:	8b 75 0c             	mov    0xc(%ebp),%esi
  801258:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  80125b:	85 db                	test   %ebx,%ebx
  80125d:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  801262:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  801265:	ff 75 14             	pushl  0x14(%ebp)
  801268:	53                   	push   %ebx
  801269:	56                   	push   %esi
  80126a:	57                   	push   %edi
  80126b:	e8 a7 fb ff ff       	call   800e17 <sys_ipc_try_send>
  801270:	83 c4 10             	add    $0x10,%esp
  801273:	85 c0                	test   %eax,%eax
  801275:	79 1e                	jns    801295 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  801277:	83 f8 f9             	cmp    $0xfffffff9,%eax
  80127a:	75 07                	jne    801283 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80127c:	e8 ce f9 ff ff       	call   800c4f <sys_yield>
  801281:	eb e2                	jmp    801265 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  801283:	50                   	push   %eax
  801284:	68 3b 28 80 00       	push   $0x80283b
  801289:	6a 3b                	push   $0x3b
  80128b:	68 4f 28 80 00       	push   $0x80284f
  801290:	e8 db ee ff ff       	call   800170 <_panic>
	}
}
  801295:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801298:	5b                   	pop    %ebx
  801299:	5e                   	pop    %esi
  80129a:	5f                   	pop    %edi
  80129b:	5d                   	pop    %ebp
  80129c:	c3                   	ret    

0080129d <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80129d:	f3 0f 1e fb          	endbr32 
  8012a1:	55                   	push   %ebp
  8012a2:	89 e5                	mov    %esp,%ebp
  8012a4:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  8012a7:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  8012ac:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8012af:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8012b5:	8b 52 50             	mov    0x50(%edx),%edx
  8012b8:	39 ca                	cmp    %ecx,%edx
  8012ba:	74 11                	je     8012cd <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  8012bc:	83 c0 01             	add    $0x1,%eax
  8012bf:	3d 00 04 00 00       	cmp    $0x400,%eax
  8012c4:	75 e6                	jne    8012ac <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  8012c6:	b8 00 00 00 00       	mov    $0x0,%eax
  8012cb:	eb 0b                	jmp    8012d8 <ipc_find_env+0x3b>
			return envs[i].env_id;
  8012cd:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8012d0:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8012d5:	8b 40 48             	mov    0x48(%eax),%eax
}
  8012d8:	5d                   	pop    %ebp
  8012d9:	c3                   	ret    

008012da <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  8012da:	f3 0f 1e fb          	endbr32 
  8012de:	55                   	push   %ebp
  8012df:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012e1:	8b 45 08             	mov    0x8(%ebp),%eax
  8012e4:	05 00 00 00 30       	add    $0x30000000,%eax
  8012e9:	c1 e8 0c             	shr    $0xc,%eax
}
  8012ec:	5d                   	pop    %ebp
  8012ed:	c3                   	ret    

008012ee <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8012ee:	f3 0f 1e fb          	endbr32 
  8012f2:	55                   	push   %ebp
  8012f3:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012f5:	8b 45 08             	mov    0x8(%ebp),%eax
  8012f8:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8012fd:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  801302:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801307:	5d                   	pop    %ebp
  801308:	c3                   	ret    

00801309 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801309:	f3 0f 1e fb          	endbr32 
  80130d:	55                   	push   %ebp
  80130e:	89 e5                	mov    %esp,%ebp
  801310:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801315:	89 c2                	mov    %eax,%edx
  801317:	c1 ea 16             	shr    $0x16,%edx
  80131a:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  801321:	f6 c2 01             	test   $0x1,%dl
  801324:	74 2d                	je     801353 <fd_alloc+0x4a>
  801326:	89 c2                	mov    %eax,%edx
  801328:	c1 ea 0c             	shr    $0xc,%edx
  80132b:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801332:	f6 c2 01             	test   $0x1,%dl
  801335:	74 1c                	je     801353 <fd_alloc+0x4a>
  801337:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  80133c:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801341:	75 d2                	jne    801315 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801343:	8b 45 08             	mov    0x8(%ebp),%eax
  801346:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  80134c:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801351:	eb 0a                	jmp    80135d <fd_alloc+0x54>
			*fd_store = fd;
  801353:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801356:	89 01                	mov    %eax,(%ecx)
			return 0;
  801358:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80135d:	5d                   	pop    %ebp
  80135e:	c3                   	ret    

0080135f <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  80135f:	f3 0f 1e fb          	endbr32 
  801363:	55                   	push   %ebp
  801364:	89 e5                	mov    %esp,%ebp
  801366:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801369:	83 f8 1f             	cmp    $0x1f,%eax
  80136c:	77 30                	ja     80139e <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  80136e:	c1 e0 0c             	shl    $0xc,%eax
  801371:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801376:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  80137c:	f6 c2 01             	test   $0x1,%dl
  80137f:	74 24                	je     8013a5 <fd_lookup+0x46>
  801381:	89 c2                	mov    %eax,%edx
  801383:	c1 ea 0c             	shr    $0xc,%edx
  801386:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80138d:	f6 c2 01             	test   $0x1,%dl
  801390:	74 1a                	je     8013ac <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801392:	8b 55 0c             	mov    0xc(%ebp),%edx
  801395:	89 02                	mov    %eax,(%edx)
	return 0;
  801397:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80139c:	5d                   	pop    %ebp
  80139d:	c3                   	ret    
		return -E_INVAL;
  80139e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8013a3:	eb f7                	jmp    80139c <fd_lookup+0x3d>
		return -E_INVAL;
  8013a5:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8013aa:	eb f0                	jmp    80139c <fd_lookup+0x3d>
  8013ac:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8013b1:	eb e9                	jmp    80139c <fd_lookup+0x3d>

008013b3 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  8013b3:	f3 0f 1e fb          	endbr32 
  8013b7:	55                   	push   %ebp
  8013b8:	89 e5                	mov    %esp,%ebp
  8013ba:	83 ec 08             	sub    $0x8,%esp
  8013bd:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8013c0:	ba d8 28 80 00       	mov    $0x8028d8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  8013c5:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  8013ca:	39 08                	cmp    %ecx,(%eax)
  8013cc:	74 33                	je     801401 <dev_lookup+0x4e>
  8013ce:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  8013d1:	8b 02                	mov    (%edx),%eax
  8013d3:	85 c0                	test   %eax,%eax
  8013d5:	75 f3                	jne    8013ca <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  8013d7:	a1 04 40 80 00       	mov    0x804004,%eax
  8013dc:	8b 40 48             	mov    0x48(%eax),%eax
  8013df:	83 ec 04             	sub    $0x4,%esp
  8013e2:	51                   	push   %ecx
  8013e3:	50                   	push   %eax
  8013e4:	68 5c 28 80 00       	push   $0x80285c
  8013e9:	e8 69 ee ff ff       	call   800257 <cprintf>
	*dev = 0;
  8013ee:	8b 45 0c             	mov    0xc(%ebp),%eax
  8013f1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8013f7:	83 c4 10             	add    $0x10,%esp
  8013fa:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8013ff:	c9                   	leave  
  801400:	c3                   	ret    
			*dev = devtab[i];
  801401:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801404:	89 01                	mov    %eax,(%ecx)
			return 0;
  801406:	b8 00 00 00 00       	mov    $0x0,%eax
  80140b:	eb f2                	jmp    8013ff <dev_lookup+0x4c>

0080140d <fd_close>:
{
  80140d:	f3 0f 1e fb          	endbr32 
  801411:	55                   	push   %ebp
  801412:	89 e5                	mov    %esp,%ebp
  801414:	57                   	push   %edi
  801415:	56                   	push   %esi
  801416:	53                   	push   %ebx
  801417:	83 ec 24             	sub    $0x24,%esp
  80141a:	8b 75 08             	mov    0x8(%ebp),%esi
  80141d:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801420:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801423:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801424:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  80142a:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80142d:	50                   	push   %eax
  80142e:	e8 2c ff ff ff       	call   80135f <fd_lookup>
  801433:	89 c3                	mov    %eax,%ebx
  801435:	83 c4 10             	add    $0x10,%esp
  801438:	85 c0                	test   %eax,%eax
  80143a:	78 05                	js     801441 <fd_close+0x34>
	    || fd != fd2)
  80143c:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  80143f:	74 16                	je     801457 <fd_close+0x4a>
		return (must_exist ? r : 0);
  801441:	89 f8                	mov    %edi,%eax
  801443:	84 c0                	test   %al,%al
  801445:	b8 00 00 00 00       	mov    $0x0,%eax
  80144a:	0f 44 d8             	cmove  %eax,%ebx
}
  80144d:	89 d8                	mov    %ebx,%eax
  80144f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801452:	5b                   	pop    %ebx
  801453:	5e                   	pop    %esi
  801454:	5f                   	pop    %edi
  801455:	5d                   	pop    %ebp
  801456:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801457:	83 ec 08             	sub    $0x8,%esp
  80145a:	8d 45 e0             	lea    -0x20(%ebp),%eax
  80145d:	50                   	push   %eax
  80145e:	ff 36                	pushl  (%esi)
  801460:	e8 4e ff ff ff       	call   8013b3 <dev_lookup>
  801465:	89 c3                	mov    %eax,%ebx
  801467:	83 c4 10             	add    $0x10,%esp
  80146a:	85 c0                	test   %eax,%eax
  80146c:	78 1a                	js     801488 <fd_close+0x7b>
		if (dev->dev_close)
  80146e:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801471:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801474:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801479:	85 c0                	test   %eax,%eax
  80147b:	74 0b                	je     801488 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  80147d:	83 ec 0c             	sub    $0xc,%esp
  801480:	56                   	push   %esi
  801481:	ff d0                	call   *%eax
  801483:	89 c3                	mov    %eax,%ebx
  801485:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801488:	83 ec 08             	sub    $0x8,%esp
  80148b:	56                   	push   %esi
  80148c:	6a 00                	push   $0x0
  80148e:	e8 6c f8 ff ff       	call   800cff <sys_page_unmap>
	return r;
  801493:	83 c4 10             	add    $0x10,%esp
  801496:	eb b5                	jmp    80144d <fd_close+0x40>

00801498 <close>:

int
close(int fdnum)
{
  801498:	f3 0f 1e fb          	endbr32 
  80149c:	55                   	push   %ebp
  80149d:	89 e5                	mov    %esp,%ebp
  80149f:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8014a2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8014a5:	50                   	push   %eax
  8014a6:	ff 75 08             	pushl  0x8(%ebp)
  8014a9:	e8 b1 fe ff ff       	call   80135f <fd_lookup>
  8014ae:	83 c4 10             	add    $0x10,%esp
  8014b1:	85 c0                	test   %eax,%eax
  8014b3:	79 02                	jns    8014b7 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8014b5:	c9                   	leave  
  8014b6:	c3                   	ret    
		return fd_close(fd, 1);
  8014b7:	83 ec 08             	sub    $0x8,%esp
  8014ba:	6a 01                	push   $0x1
  8014bc:	ff 75 f4             	pushl  -0xc(%ebp)
  8014bf:	e8 49 ff ff ff       	call   80140d <fd_close>
  8014c4:	83 c4 10             	add    $0x10,%esp
  8014c7:	eb ec                	jmp    8014b5 <close+0x1d>

008014c9 <close_all>:

void
close_all(void)
{
  8014c9:	f3 0f 1e fb          	endbr32 
  8014cd:	55                   	push   %ebp
  8014ce:	89 e5                	mov    %esp,%ebp
  8014d0:	53                   	push   %ebx
  8014d1:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  8014d4:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  8014d9:	83 ec 0c             	sub    $0xc,%esp
  8014dc:	53                   	push   %ebx
  8014dd:	e8 b6 ff ff ff       	call   801498 <close>
	for (i = 0; i < MAXFD; i++)
  8014e2:	83 c3 01             	add    $0x1,%ebx
  8014e5:	83 c4 10             	add    $0x10,%esp
  8014e8:	83 fb 20             	cmp    $0x20,%ebx
  8014eb:	75 ec                	jne    8014d9 <close_all+0x10>
}
  8014ed:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014f0:	c9                   	leave  
  8014f1:	c3                   	ret    

008014f2 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8014f2:	f3 0f 1e fb          	endbr32 
  8014f6:	55                   	push   %ebp
  8014f7:	89 e5                	mov    %esp,%ebp
  8014f9:	57                   	push   %edi
  8014fa:	56                   	push   %esi
  8014fb:	53                   	push   %ebx
  8014fc:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8014ff:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  801502:	50                   	push   %eax
  801503:	ff 75 08             	pushl  0x8(%ebp)
  801506:	e8 54 fe ff ff       	call   80135f <fd_lookup>
  80150b:	89 c3                	mov    %eax,%ebx
  80150d:	83 c4 10             	add    $0x10,%esp
  801510:	85 c0                	test   %eax,%eax
  801512:	0f 88 81 00 00 00    	js     801599 <dup+0xa7>
		return r;
	close(newfdnum);
  801518:	83 ec 0c             	sub    $0xc,%esp
  80151b:	ff 75 0c             	pushl  0xc(%ebp)
  80151e:	e8 75 ff ff ff       	call   801498 <close>

	newfd = INDEX2FD(newfdnum);
  801523:	8b 75 0c             	mov    0xc(%ebp),%esi
  801526:	c1 e6 0c             	shl    $0xc,%esi
  801529:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  80152f:	83 c4 04             	add    $0x4,%esp
  801532:	ff 75 e4             	pushl  -0x1c(%ebp)
  801535:	e8 b4 fd ff ff       	call   8012ee <fd2data>
  80153a:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  80153c:	89 34 24             	mov    %esi,(%esp)
  80153f:	e8 aa fd ff ff       	call   8012ee <fd2data>
  801544:	83 c4 10             	add    $0x10,%esp
  801547:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801549:	89 d8                	mov    %ebx,%eax
  80154b:	c1 e8 16             	shr    $0x16,%eax
  80154e:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801555:	a8 01                	test   $0x1,%al
  801557:	74 11                	je     80156a <dup+0x78>
  801559:	89 d8                	mov    %ebx,%eax
  80155b:	c1 e8 0c             	shr    $0xc,%eax
  80155e:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801565:	f6 c2 01             	test   $0x1,%dl
  801568:	75 39                	jne    8015a3 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80156a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  80156d:	89 d0                	mov    %edx,%eax
  80156f:	c1 e8 0c             	shr    $0xc,%eax
  801572:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801579:	83 ec 0c             	sub    $0xc,%esp
  80157c:	25 07 0e 00 00       	and    $0xe07,%eax
  801581:	50                   	push   %eax
  801582:	56                   	push   %esi
  801583:	6a 00                	push   $0x0
  801585:	52                   	push   %edx
  801586:	6a 00                	push   $0x0
  801588:	e8 2c f7 ff ff       	call   800cb9 <sys_page_map>
  80158d:	89 c3                	mov    %eax,%ebx
  80158f:	83 c4 20             	add    $0x20,%esp
  801592:	85 c0                	test   %eax,%eax
  801594:	78 31                	js     8015c7 <dup+0xd5>
		goto err;

	return newfdnum;
  801596:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801599:	89 d8                	mov    %ebx,%eax
  80159b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80159e:	5b                   	pop    %ebx
  80159f:	5e                   	pop    %esi
  8015a0:	5f                   	pop    %edi
  8015a1:	5d                   	pop    %ebp
  8015a2:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8015a3:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8015aa:	83 ec 0c             	sub    $0xc,%esp
  8015ad:	25 07 0e 00 00       	and    $0xe07,%eax
  8015b2:	50                   	push   %eax
  8015b3:	57                   	push   %edi
  8015b4:	6a 00                	push   $0x0
  8015b6:	53                   	push   %ebx
  8015b7:	6a 00                	push   $0x0
  8015b9:	e8 fb f6 ff ff       	call   800cb9 <sys_page_map>
  8015be:	89 c3                	mov    %eax,%ebx
  8015c0:	83 c4 20             	add    $0x20,%esp
  8015c3:	85 c0                	test   %eax,%eax
  8015c5:	79 a3                	jns    80156a <dup+0x78>
	sys_page_unmap(0, newfd);
  8015c7:	83 ec 08             	sub    $0x8,%esp
  8015ca:	56                   	push   %esi
  8015cb:	6a 00                	push   $0x0
  8015cd:	e8 2d f7 ff ff       	call   800cff <sys_page_unmap>
	sys_page_unmap(0, nva);
  8015d2:	83 c4 08             	add    $0x8,%esp
  8015d5:	57                   	push   %edi
  8015d6:	6a 00                	push   $0x0
  8015d8:	e8 22 f7 ff ff       	call   800cff <sys_page_unmap>
	return r;
  8015dd:	83 c4 10             	add    $0x10,%esp
  8015e0:	eb b7                	jmp    801599 <dup+0xa7>

008015e2 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8015e2:	f3 0f 1e fb          	endbr32 
  8015e6:	55                   	push   %ebp
  8015e7:	89 e5                	mov    %esp,%ebp
  8015e9:	53                   	push   %ebx
  8015ea:	83 ec 1c             	sub    $0x1c,%esp
  8015ed:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8015f0:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8015f3:	50                   	push   %eax
  8015f4:	53                   	push   %ebx
  8015f5:	e8 65 fd ff ff       	call   80135f <fd_lookup>
  8015fa:	83 c4 10             	add    $0x10,%esp
  8015fd:	85 c0                	test   %eax,%eax
  8015ff:	78 3f                	js     801640 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801601:	83 ec 08             	sub    $0x8,%esp
  801604:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801607:	50                   	push   %eax
  801608:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80160b:	ff 30                	pushl  (%eax)
  80160d:	e8 a1 fd ff ff       	call   8013b3 <dev_lookup>
  801612:	83 c4 10             	add    $0x10,%esp
  801615:	85 c0                	test   %eax,%eax
  801617:	78 27                	js     801640 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801619:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80161c:	8b 42 08             	mov    0x8(%edx),%eax
  80161f:	83 e0 03             	and    $0x3,%eax
  801622:	83 f8 01             	cmp    $0x1,%eax
  801625:	74 1e                	je     801645 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801627:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80162a:	8b 40 08             	mov    0x8(%eax),%eax
  80162d:	85 c0                	test   %eax,%eax
  80162f:	74 35                	je     801666 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  801631:	83 ec 04             	sub    $0x4,%esp
  801634:	ff 75 10             	pushl  0x10(%ebp)
  801637:	ff 75 0c             	pushl  0xc(%ebp)
  80163a:	52                   	push   %edx
  80163b:	ff d0                	call   *%eax
  80163d:	83 c4 10             	add    $0x10,%esp
}
  801640:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801643:	c9                   	leave  
  801644:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801645:	a1 04 40 80 00       	mov    0x804004,%eax
  80164a:	8b 40 48             	mov    0x48(%eax),%eax
  80164d:	83 ec 04             	sub    $0x4,%esp
  801650:	53                   	push   %ebx
  801651:	50                   	push   %eax
  801652:	68 9d 28 80 00       	push   $0x80289d
  801657:	e8 fb eb ff ff       	call   800257 <cprintf>
		return -E_INVAL;
  80165c:	83 c4 10             	add    $0x10,%esp
  80165f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801664:	eb da                	jmp    801640 <read+0x5e>
		return -E_NOT_SUPP;
  801666:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80166b:	eb d3                	jmp    801640 <read+0x5e>

0080166d <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  80166d:	f3 0f 1e fb          	endbr32 
  801671:	55                   	push   %ebp
  801672:	89 e5                	mov    %esp,%ebp
  801674:	57                   	push   %edi
  801675:	56                   	push   %esi
  801676:	53                   	push   %ebx
  801677:	83 ec 0c             	sub    $0xc,%esp
  80167a:	8b 7d 08             	mov    0x8(%ebp),%edi
  80167d:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801680:	bb 00 00 00 00       	mov    $0x0,%ebx
  801685:	eb 02                	jmp    801689 <readn+0x1c>
  801687:	01 c3                	add    %eax,%ebx
  801689:	39 f3                	cmp    %esi,%ebx
  80168b:	73 21                	jae    8016ae <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80168d:	83 ec 04             	sub    $0x4,%esp
  801690:	89 f0                	mov    %esi,%eax
  801692:	29 d8                	sub    %ebx,%eax
  801694:	50                   	push   %eax
  801695:	89 d8                	mov    %ebx,%eax
  801697:	03 45 0c             	add    0xc(%ebp),%eax
  80169a:	50                   	push   %eax
  80169b:	57                   	push   %edi
  80169c:	e8 41 ff ff ff       	call   8015e2 <read>
		if (m < 0)
  8016a1:	83 c4 10             	add    $0x10,%esp
  8016a4:	85 c0                	test   %eax,%eax
  8016a6:	78 04                	js     8016ac <readn+0x3f>
			return m;
		if (m == 0)
  8016a8:	75 dd                	jne    801687 <readn+0x1a>
  8016aa:	eb 02                	jmp    8016ae <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8016ac:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8016ae:	89 d8                	mov    %ebx,%eax
  8016b0:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8016b3:	5b                   	pop    %ebx
  8016b4:	5e                   	pop    %esi
  8016b5:	5f                   	pop    %edi
  8016b6:	5d                   	pop    %ebp
  8016b7:	c3                   	ret    

008016b8 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8016b8:	f3 0f 1e fb          	endbr32 
  8016bc:	55                   	push   %ebp
  8016bd:	89 e5                	mov    %esp,%ebp
  8016bf:	53                   	push   %ebx
  8016c0:	83 ec 1c             	sub    $0x1c,%esp
  8016c3:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8016c6:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8016c9:	50                   	push   %eax
  8016ca:	53                   	push   %ebx
  8016cb:	e8 8f fc ff ff       	call   80135f <fd_lookup>
  8016d0:	83 c4 10             	add    $0x10,%esp
  8016d3:	85 c0                	test   %eax,%eax
  8016d5:	78 3a                	js     801711 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8016d7:	83 ec 08             	sub    $0x8,%esp
  8016da:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016dd:	50                   	push   %eax
  8016de:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016e1:	ff 30                	pushl  (%eax)
  8016e3:	e8 cb fc ff ff       	call   8013b3 <dev_lookup>
  8016e8:	83 c4 10             	add    $0x10,%esp
  8016eb:	85 c0                	test   %eax,%eax
  8016ed:	78 22                	js     801711 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8016ef:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016f2:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8016f6:	74 1e                	je     801716 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8016f8:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016fb:	8b 52 0c             	mov    0xc(%edx),%edx
  8016fe:	85 d2                	test   %edx,%edx
  801700:	74 35                	je     801737 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  801702:	83 ec 04             	sub    $0x4,%esp
  801705:	ff 75 10             	pushl  0x10(%ebp)
  801708:	ff 75 0c             	pushl  0xc(%ebp)
  80170b:	50                   	push   %eax
  80170c:	ff d2                	call   *%edx
  80170e:	83 c4 10             	add    $0x10,%esp
}
  801711:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801714:	c9                   	leave  
  801715:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801716:	a1 04 40 80 00       	mov    0x804004,%eax
  80171b:	8b 40 48             	mov    0x48(%eax),%eax
  80171e:	83 ec 04             	sub    $0x4,%esp
  801721:	53                   	push   %ebx
  801722:	50                   	push   %eax
  801723:	68 b9 28 80 00       	push   $0x8028b9
  801728:	e8 2a eb ff ff       	call   800257 <cprintf>
		return -E_INVAL;
  80172d:	83 c4 10             	add    $0x10,%esp
  801730:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801735:	eb da                	jmp    801711 <write+0x59>
		return -E_NOT_SUPP;
  801737:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80173c:	eb d3                	jmp    801711 <write+0x59>

0080173e <seek>:

int
seek(int fdnum, off_t offset)
{
  80173e:	f3 0f 1e fb          	endbr32 
  801742:	55                   	push   %ebp
  801743:	89 e5                	mov    %esp,%ebp
  801745:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801748:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80174b:	50                   	push   %eax
  80174c:	ff 75 08             	pushl  0x8(%ebp)
  80174f:	e8 0b fc ff ff       	call   80135f <fd_lookup>
  801754:	83 c4 10             	add    $0x10,%esp
  801757:	85 c0                	test   %eax,%eax
  801759:	78 0e                	js     801769 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80175b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80175e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801761:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801764:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801769:	c9                   	leave  
  80176a:	c3                   	ret    

0080176b <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80176b:	f3 0f 1e fb          	endbr32 
  80176f:	55                   	push   %ebp
  801770:	89 e5                	mov    %esp,%ebp
  801772:	53                   	push   %ebx
  801773:	83 ec 1c             	sub    $0x1c,%esp
  801776:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801779:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80177c:	50                   	push   %eax
  80177d:	53                   	push   %ebx
  80177e:	e8 dc fb ff ff       	call   80135f <fd_lookup>
  801783:	83 c4 10             	add    $0x10,%esp
  801786:	85 c0                	test   %eax,%eax
  801788:	78 37                	js     8017c1 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80178a:	83 ec 08             	sub    $0x8,%esp
  80178d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801790:	50                   	push   %eax
  801791:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801794:	ff 30                	pushl  (%eax)
  801796:	e8 18 fc ff ff       	call   8013b3 <dev_lookup>
  80179b:	83 c4 10             	add    $0x10,%esp
  80179e:	85 c0                	test   %eax,%eax
  8017a0:	78 1f                	js     8017c1 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8017a2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017a5:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8017a9:	74 1b                	je     8017c6 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8017ab:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8017ae:	8b 52 18             	mov    0x18(%edx),%edx
  8017b1:	85 d2                	test   %edx,%edx
  8017b3:	74 32                	je     8017e7 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8017b5:	83 ec 08             	sub    $0x8,%esp
  8017b8:	ff 75 0c             	pushl  0xc(%ebp)
  8017bb:	50                   	push   %eax
  8017bc:	ff d2                	call   *%edx
  8017be:	83 c4 10             	add    $0x10,%esp
}
  8017c1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8017c4:	c9                   	leave  
  8017c5:	c3                   	ret    
			thisenv->env_id, fdnum);
  8017c6:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8017cb:	8b 40 48             	mov    0x48(%eax),%eax
  8017ce:	83 ec 04             	sub    $0x4,%esp
  8017d1:	53                   	push   %ebx
  8017d2:	50                   	push   %eax
  8017d3:	68 7c 28 80 00       	push   $0x80287c
  8017d8:	e8 7a ea ff ff       	call   800257 <cprintf>
		return -E_INVAL;
  8017dd:	83 c4 10             	add    $0x10,%esp
  8017e0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8017e5:	eb da                	jmp    8017c1 <ftruncate+0x56>
		return -E_NOT_SUPP;
  8017e7:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017ec:	eb d3                	jmp    8017c1 <ftruncate+0x56>

008017ee <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8017ee:	f3 0f 1e fb          	endbr32 
  8017f2:	55                   	push   %ebp
  8017f3:	89 e5                	mov    %esp,%ebp
  8017f5:	53                   	push   %ebx
  8017f6:	83 ec 1c             	sub    $0x1c,%esp
  8017f9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017fc:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017ff:	50                   	push   %eax
  801800:	ff 75 08             	pushl  0x8(%ebp)
  801803:	e8 57 fb ff ff       	call   80135f <fd_lookup>
  801808:	83 c4 10             	add    $0x10,%esp
  80180b:	85 c0                	test   %eax,%eax
  80180d:	78 4b                	js     80185a <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80180f:	83 ec 08             	sub    $0x8,%esp
  801812:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801815:	50                   	push   %eax
  801816:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801819:	ff 30                	pushl  (%eax)
  80181b:	e8 93 fb ff ff       	call   8013b3 <dev_lookup>
  801820:	83 c4 10             	add    $0x10,%esp
  801823:	85 c0                	test   %eax,%eax
  801825:	78 33                	js     80185a <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801827:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80182a:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  80182e:	74 2f                	je     80185f <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801830:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801833:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80183a:	00 00 00 
	stat->st_isdir = 0;
  80183d:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801844:	00 00 00 
	stat->st_dev = dev;
  801847:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  80184d:	83 ec 08             	sub    $0x8,%esp
  801850:	53                   	push   %ebx
  801851:	ff 75 f0             	pushl  -0x10(%ebp)
  801854:	ff 50 14             	call   *0x14(%eax)
  801857:	83 c4 10             	add    $0x10,%esp
}
  80185a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80185d:	c9                   	leave  
  80185e:	c3                   	ret    
		return -E_NOT_SUPP;
  80185f:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801864:	eb f4                	jmp    80185a <fstat+0x6c>

00801866 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801866:	f3 0f 1e fb          	endbr32 
  80186a:	55                   	push   %ebp
  80186b:	89 e5                	mov    %esp,%ebp
  80186d:	56                   	push   %esi
  80186e:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  80186f:	83 ec 08             	sub    $0x8,%esp
  801872:	6a 00                	push   $0x0
  801874:	ff 75 08             	pushl  0x8(%ebp)
  801877:	e8 fb 01 00 00       	call   801a77 <open>
  80187c:	89 c3                	mov    %eax,%ebx
  80187e:	83 c4 10             	add    $0x10,%esp
  801881:	85 c0                	test   %eax,%eax
  801883:	78 1b                	js     8018a0 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801885:	83 ec 08             	sub    $0x8,%esp
  801888:	ff 75 0c             	pushl  0xc(%ebp)
  80188b:	50                   	push   %eax
  80188c:	e8 5d ff ff ff       	call   8017ee <fstat>
  801891:	89 c6                	mov    %eax,%esi
	close(fd);
  801893:	89 1c 24             	mov    %ebx,(%esp)
  801896:	e8 fd fb ff ff       	call   801498 <close>
	return r;
  80189b:	83 c4 10             	add    $0x10,%esp
  80189e:	89 f3                	mov    %esi,%ebx
}
  8018a0:	89 d8                	mov    %ebx,%eax
  8018a2:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8018a5:	5b                   	pop    %ebx
  8018a6:	5e                   	pop    %esi
  8018a7:	5d                   	pop    %ebp
  8018a8:	c3                   	ret    

008018a9 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8018a9:	55                   	push   %ebp
  8018aa:	89 e5                	mov    %esp,%ebp
  8018ac:	56                   	push   %esi
  8018ad:	53                   	push   %ebx
  8018ae:	89 c6                	mov    %eax,%esi
  8018b0:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  8018b2:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  8018b9:	74 27                	je     8018e2 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  8018bb:	6a 07                	push   $0x7
  8018bd:	68 00 50 80 00       	push   $0x805000
  8018c2:	56                   	push   %esi
  8018c3:	ff 35 00 40 80 00    	pushl  0x804000
  8018c9:	e8 77 f9 ff ff       	call   801245 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  8018ce:	83 c4 0c             	add    $0xc,%esp
  8018d1:	6a 00                	push   $0x0
  8018d3:	53                   	push   %ebx
  8018d4:	6a 00                	push   $0x0
  8018d6:	e8 e9 f8 ff ff       	call   8011c4 <ipc_recv>
}
  8018db:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8018de:	5b                   	pop    %ebx
  8018df:	5e                   	pop    %esi
  8018e0:	5d                   	pop    %ebp
  8018e1:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8018e2:	83 ec 0c             	sub    $0xc,%esp
  8018e5:	6a 01                	push   $0x1
  8018e7:	e8 b1 f9 ff ff       	call   80129d <ipc_find_env>
  8018ec:	a3 00 40 80 00       	mov    %eax,0x804000
  8018f1:	83 c4 10             	add    $0x10,%esp
  8018f4:	eb c5                	jmp    8018bb <fsipc+0x12>

008018f6 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8018f6:	f3 0f 1e fb          	endbr32 
  8018fa:	55                   	push   %ebp
  8018fb:	89 e5                	mov    %esp,%ebp
  8018fd:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801900:	8b 45 08             	mov    0x8(%ebp),%eax
  801903:	8b 40 0c             	mov    0xc(%eax),%eax
  801906:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  80190b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80190e:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801913:	ba 00 00 00 00       	mov    $0x0,%edx
  801918:	b8 02 00 00 00       	mov    $0x2,%eax
  80191d:	e8 87 ff ff ff       	call   8018a9 <fsipc>
}
  801922:	c9                   	leave  
  801923:	c3                   	ret    

00801924 <devfile_flush>:
{
  801924:	f3 0f 1e fb          	endbr32 
  801928:	55                   	push   %ebp
  801929:	89 e5                	mov    %esp,%ebp
  80192b:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  80192e:	8b 45 08             	mov    0x8(%ebp),%eax
  801931:	8b 40 0c             	mov    0xc(%eax),%eax
  801934:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801939:	ba 00 00 00 00       	mov    $0x0,%edx
  80193e:	b8 06 00 00 00       	mov    $0x6,%eax
  801943:	e8 61 ff ff ff       	call   8018a9 <fsipc>
}
  801948:	c9                   	leave  
  801949:	c3                   	ret    

0080194a <devfile_stat>:
{
  80194a:	f3 0f 1e fb          	endbr32 
  80194e:	55                   	push   %ebp
  80194f:	89 e5                	mov    %esp,%ebp
  801951:	53                   	push   %ebx
  801952:	83 ec 04             	sub    $0x4,%esp
  801955:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801958:	8b 45 08             	mov    0x8(%ebp),%eax
  80195b:	8b 40 0c             	mov    0xc(%eax),%eax
  80195e:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801963:	ba 00 00 00 00       	mov    $0x0,%edx
  801968:	b8 05 00 00 00       	mov    $0x5,%eax
  80196d:	e8 37 ff ff ff       	call   8018a9 <fsipc>
  801972:	85 c0                	test   %eax,%eax
  801974:	78 2c                	js     8019a2 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801976:	83 ec 08             	sub    $0x8,%esp
  801979:	68 00 50 80 00       	push   $0x805000
  80197e:	53                   	push   %ebx
  80197f:	e8 ac ee ff ff       	call   800830 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801984:	a1 80 50 80 00       	mov    0x805080,%eax
  801989:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  80198f:	a1 84 50 80 00       	mov    0x805084,%eax
  801994:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80199a:	83 c4 10             	add    $0x10,%esp
  80199d:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8019a2:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8019a5:	c9                   	leave  
  8019a6:	c3                   	ret    

008019a7 <devfile_write>:
{
  8019a7:	f3 0f 1e fb          	endbr32 
  8019ab:	55                   	push   %ebp
  8019ac:	89 e5                	mov    %esp,%ebp
  8019ae:	83 ec 0c             	sub    $0xc,%esp
  8019b1:	8b 45 10             	mov    0x10(%ebp),%eax
  8019b4:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  8019b9:	ba f8 0f 00 00       	mov    $0xff8,%edx
  8019be:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  8019c1:	8b 55 08             	mov    0x8(%ebp),%edx
  8019c4:	8b 52 0c             	mov    0xc(%edx),%edx
  8019c7:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  8019cd:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  8019d2:	50                   	push   %eax
  8019d3:	ff 75 0c             	pushl  0xc(%ebp)
  8019d6:	68 08 50 80 00       	push   $0x805008
  8019db:	e8 06 f0 ff ff       	call   8009e6 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8019e0:	ba 00 00 00 00       	mov    $0x0,%edx
  8019e5:	b8 04 00 00 00       	mov    $0x4,%eax
  8019ea:	e8 ba fe ff ff       	call   8018a9 <fsipc>
  8019ef:	c9                   	leave  
  8019f0:	c3                   	ret    

008019f1 <devfile_read>:
{
  8019f1:	f3 0f 1e fb          	endbr32 
  8019f5:	55                   	push   %ebp
  8019f6:	89 e5                	mov    %esp,%ebp
  8019f8:	56                   	push   %esi
  8019f9:	53                   	push   %ebx
  8019fa:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8019fd:	8b 45 08             	mov    0x8(%ebp),%eax
  801a00:	8b 40 0c             	mov    0xc(%eax),%eax
  801a03:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801a08:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801a0e:	ba 00 00 00 00       	mov    $0x0,%edx
  801a13:	b8 03 00 00 00       	mov    $0x3,%eax
  801a18:	e8 8c fe ff ff       	call   8018a9 <fsipc>
  801a1d:	89 c3                	mov    %eax,%ebx
  801a1f:	85 c0                	test   %eax,%eax
  801a21:	78 1f                	js     801a42 <devfile_read+0x51>
	assert(r <= n);
  801a23:	39 f0                	cmp    %esi,%eax
  801a25:	77 24                	ja     801a4b <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801a27:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801a2c:	7f 33                	jg     801a61 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801a2e:	83 ec 04             	sub    $0x4,%esp
  801a31:	50                   	push   %eax
  801a32:	68 00 50 80 00       	push   $0x805000
  801a37:	ff 75 0c             	pushl  0xc(%ebp)
  801a3a:	e8 a7 ef ff ff       	call   8009e6 <memmove>
	return r;
  801a3f:	83 c4 10             	add    $0x10,%esp
}
  801a42:	89 d8                	mov    %ebx,%eax
  801a44:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a47:	5b                   	pop    %ebx
  801a48:	5e                   	pop    %esi
  801a49:	5d                   	pop    %ebp
  801a4a:	c3                   	ret    
	assert(r <= n);
  801a4b:	68 e8 28 80 00       	push   $0x8028e8
  801a50:	68 ef 28 80 00       	push   $0x8028ef
  801a55:	6a 7c                	push   $0x7c
  801a57:	68 04 29 80 00       	push   $0x802904
  801a5c:	e8 0f e7 ff ff       	call   800170 <_panic>
	assert(r <= PGSIZE);
  801a61:	68 0f 29 80 00       	push   $0x80290f
  801a66:	68 ef 28 80 00       	push   $0x8028ef
  801a6b:	6a 7d                	push   $0x7d
  801a6d:	68 04 29 80 00       	push   $0x802904
  801a72:	e8 f9 e6 ff ff       	call   800170 <_panic>

00801a77 <open>:
{
  801a77:	f3 0f 1e fb          	endbr32 
  801a7b:	55                   	push   %ebp
  801a7c:	89 e5                	mov    %esp,%ebp
  801a7e:	56                   	push   %esi
  801a7f:	53                   	push   %ebx
  801a80:	83 ec 1c             	sub    $0x1c,%esp
  801a83:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801a86:	56                   	push   %esi
  801a87:	e8 61 ed ff ff       	call   8007ed <strlen>
  801a8c:	83 c4 10             	add    $0x10,%esp
  801a8f:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801a94:	7f 6c                	jg     801b02 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801a96:	83 ec 0c             	sub    $0xc,%esp
  801a99:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a9c:	50                   	push   %eax
  801a9d:	e8 67 f8 ff ff       	call   801309 <fd_alloc>
  801aa2:	89 c3                	mov    %eax,%ebx
  801aa4:	83 c4 10             	add    $0x10,%esp
  801aa7:	85 c0                	test   %eax,%eax
  801aa9:	78 3c                	js     801ae7 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801aab:	83 ec 08             	sub    $0x8,%esp
  801aae:	56                   	push   %esi
  801aaf:	68 00 50 80 00       	push   $0x805000
  801ab4:	e8 77 ed ff ff       	call   800830 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801ab9:	8b 45 0c             	mov    0xc(%ebp),%eax
  801abc:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801ac1:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801ac4:	b8 01 00 00 00       	mov    $0x1,%eax
  801ac9:	e8 db fd ff ff       	call   8018a9 <fsipc>
  801ace:	89 c3                	mov    %eax,%ebx
  801ad0:	83 c4 10             	add    $0x10,%esp
  801ad3:	85 c0                	test   %eax,%eax
  801ad5:	78 19                	js     801af0 <open+0x79>
	return fd2num(fd);
  801ad7:	83 ec 0c             	sub    $0xc,%esp
  801ada:	ff 75 f4             	pushl  -0xc(%ebp)
  801add:	e8 f8 f7 ff ff       	call   8012da <fd2num>
  801ae2:	89 c3                	mov    %eax,%ebx
  801ae4:	83 c4 10             	add    $0x10,%esp
}
  801ae7:	89 d8                	mov    %ebx,%eax
  801ae9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aec:	5b                   	pop    %ebx
  801aed:	5e                   	pop    %esi
  801aee:	5d                   	pop    %ebp
  801aef:	c3                   	ret    
		fd_close(fd, 0);
  801af0:	83 ec 08             	sub    $0x8,%esp
  801af3:	6a 00                	push   $0x0
  801af5:	ff 75 f4             	pushl  -0xc(%ebp)
  801af8:	e8 10 f9 ff ff       	call   80140d <fd_close>
		return r;
  801afd:	83 c4 10             	add    $0x10,%esp
  801b00:	eb e5                	jmp    801ae7 <open+0x70>
		return -E_BAD_PATH;
  801b02:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801b07:	eb de                	jmp    801ae7 <open+0x70>

00801b09 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801b09:	f3 0f 1e fb          	endbr32 
  801b0d:	55                   	push   %ebp
  801b0e:	89 e5                	mov    %esp,%ebp
  801b10:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801b13:	ba 00 00 00 00       	mov    $0x0,%edx
  801b18:	b8 08 00 00 00       	mov    $0x8,%eax
  801b1d:	e8 87 fd ff ff       	call   8018a9 <fsipc>
}
  801b22:	c9                   	leave  
  801b23:	c3                   	ret    

00801b24 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801b24:	f3 0f 1e fb          	endbr32 
  801b28:	55                   	push   %ebp
  801b29:	89 e5                	mov    %esp,%ebp
  801b2b:	56                   	push   %esi
  801b2c:	53                   	push   %ebx
  801b2d:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801b30:	83 ec 0c             	sub    $0xc,%esp
  801b33:	ff 75 08             	pushl  0x8(%ebp)
  801b36:	e8 b3 f7 ff ff       	call   8012ee <fd2data>
  801b3b:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801b3d:	83 c4 08             	add    $0x8,%esp
  801b40:	68 1b 29 80 00       	push   $0x80291b
  801b45:	53                   	push   %ebx
  801b46:	e8 e5 ec ff ff       	call   800830 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801b4b:	8b 46 04             	mov    0x4(%esi),%eax
  801b4e:	2b 06                	sub    (%esi),%eax
  801b50:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801b56:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801b5d:	00 00 00 
	stat->st_dev = &devpipe;
  801b60:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801b67:	30 80 00 
	return 0;
}
  801b6a:	b8 00 00 00 00       	mov    $0x0,%eax
  801b6f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b72:	5b                   	pop    %ebx
  801b73:	5e                   	pop    %esi
  801b74:	5d                   	pop    %ebp
  801b75:	c3                   	ret    

00801b76 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801b76:	f3 0f 1e fb          	endbr32 
  801b7a:	55                   	push   %ebp
  801b7b:	89 e5                	mov    %esp,%ebp
  801b7d:	53                   	push   %ebx
  801b7e:	83 ec 0c             	sub    $0xc,%esp
  801b81:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801b84:	53                   	push   %ebx
  801b85:	6a 00                	push   $0x0
  801b87:	e8 73 f1 ff ff       	call   800cff <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801b8c:	89 1c 24             	mov    %ebx,(%esp)
  801b8f:	e8 5a f7 ff ff       	call   8012ee <fd2data>
  801b94:	83 c4 08             	add    $0x8,%esp
  801b97:	50                   	push   %eax
  801b98:	6a 00                	push   $0x0
  801b9a:	e8 60 f1 ff ff       	call   800cff <sys_page_unmap>
}
  801b9f:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801ba2:	c9                   	leave  
  801ba3:	c3                   	ret    

00801ba4 <_pipeisclosed>:
{
  801ba4:	55                   	push   %ebp
  801ba5:	89 e5                	mov    %esp,%ebp
  801ba7:	57                   	push   %edi
  801ba8:	56                   	push   %esi
  801ba9:	53                   	push   %ebx
  801baa:	83 ec 1c             	sub    $0x1c,%esp
  801bad:	89 c7                	mov    %eax,%edi
  801baf:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801bb1:	a1 04 40 80 00       	mov    0x804004,%eax
  801bb6:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801bb9:	83 ec 0c             	sub    $0xc,%esp
  801bbc:	57                   	push   %edi
  801bbd:	e8 fe 04 00 00       	call   8020c0 <pageref>
  801bc2:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801bc5:	89 34 24             	mov    %esi,(%esp)
  801bc8:	e8 f3 04 00 00       	call   8020c0 <pageref>
		nn = thisenv->env_runs;
  801bcd:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801bd3:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801bd6:	83 c4 10             	add    $0x10,%esp
  801bd9:	39 cb                	cmp    %ecx,%ebx
  801bdb:	74 1b                	je     801bf8 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801bdd:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801be0:	75 cf                	jne    801bb1 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801be2:	8b 42 58             	mov    0x58(%edx),%eax
  801be5:	6a 01                	push   $0x1
  801be7:	50                   	push   %eax
  801be8:	53                   	push   %ebx
  801be9:	68 22 29 80 00       	push   $0x802922
  801bee:	e8 64 e6 ff ff       	call   800257 <cprintf>
  801bf3:	83 c4 10             	add    $0x10,%esp
  801bf6:	eb b9                	jmp    801bb1 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801bf8:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801bfb:	0f 94 c0             	sete   %al
  801bfe:	0f b6 c0             	movzbl %al,%eax
}
  801c01:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c04:	5b                   	pop    %ebx
  801c05:	5e                   	pop    %esi
  801c06:	5f                   	pop    %edi
  801c07:	5d                   	pop    %ebp
  801c08:	c3                   	ret    

00801c09 <devpipe_write>:
{
  801c09:	f3 0f 1e fb          	endbr32 
  801c0d:	55                   	push   %ebp
  801c0e:	89 e5                	mov    %esp,%ebp
  801c10:	57                   	push   %edi
  801c11:	56                   	push   %esi
  801c12:	53                   	push   %ebx
  801c13:	83 ec 28             	sub    $0x28,%esp
  801c16:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801c19:	56                   	push   %esi
  801c1a:	e8 cf f6 ff ff       	call   8012ee <fd2data>
  801c1f:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c21:	83 c4 10             	add    $0x10,%esp
  801c24:	bf 00 00 00 00       	mov    $0x0,%edi
  801c29:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801c2c:	74 4f                	je     801c7d <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801c2e:	8b 43 04             	mov    0x4(%ebx),%eax
  801c31:	8b 0b                	mov    (%ebx),%ecx
  801c33:	8d 51 20             	lea    0x20(%ecx),%edx
  801c36:	39 d0                	cmp    %edx,%eax
  801c38:	72 14                	jb     801c4e <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801c3a:	89 da                	mov    %ebx,%edx
  801c3c:	89 f0                	mov    %esi,%eax
  801c3e:	e8 61 ff ff ff       	call   801ba4 <_pipeisclosed>
  801c43:	85 c0                	test   %eax,%eax
  801c45:	75 3b                	jne    801c82 <devpipe_write+0x79>
			sys_yield();
  801c47:	e8 03 f0 ff ff       	call   800c4f <sys_yield>
  801c4c:	eb e0                	jmp    801c2e <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801c4e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c51:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801c55:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801c58:	89 c2                	mov    %eax,%edx
  801c5a:	c1 fa 1f             	sar    $0x1f,%edx
  801c5d:	89 d1                	mov    %edx,%ecx
  801c5f:	c1 e9 1b             	shr    $0x1b,%ecx
  801c62:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801c65:	83 e2 1f             	and    $0x1f,%edx
  801c68:	29 ca                	sub    %ecx,%edx
  801c6a:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801c6e:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801c72:	83 c0 01             	add    $0x1,%eax
  801c75:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801c78:	83 c7 01             	add    $0x1,%edi
  801c7b:	eb ac                	jmp    801c29 <devpipe_write+0x20>
	return i;
  801c7d:	8b 45 10             	mov    0x10(%ebp),%eax
  801c80:	eb 05                	jmp    801c87 <devpipe_write+0x7e>
				return 0;
  801c82:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801c87:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c8a:	5b                   	pop    %ebx
  801c8b:	5e                   	pop    %esi
  801c8c:	5f                   	pop    %edi
  801c8d:	5d                   	pop    %ebp
  801c8e:	c3                   	ret    

00801c8f <devpipe_read>:
{
  801c8f:	f3 0f 1e fb          	endbr32 
  801c93:	55                   	push   %ebp
  801c94:	89 e5                	mov    %esp,%ebp
  801c96:	57                   	push   %edi
  801c97:	56                   	push   %esi
  801c98:	53                   	push   %ebx
  801c99:	83 ec 18             	sub    $0x18,%esp
  801c9c:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801c9f:	57                   	push   %edi
  801ca0:	e8 49 f6 ff ff       	call   8012ee <fd2data>
  801ca5:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ca7:	83 c4 10             	add    $0x10,%esp
  801caa:	be 00 00 00 00       	mov    $0x0,%esi
  801caf:	3b 75 10             	cmp    0x10(%ebp),%esi
  801cb2:	75 14                	jne    801cc8 <devpipe_read+0x39>
	return i;
  801cb4:	8b 45 10             	mov    0x10(%ebp),%eax
  801cb7:	eb 02                	jmp    801cbb <devpipe_read+0x2c>
				return i;
  801cb9:	89 f0                	mov    %esi,%eax
}
  801cbb:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801cbe:	5b                   	pop    %ebx
  801cbf:	5e                   	pop    %esi
  801cc0:	5f                   	pop    %edi
  801cc1:	5d                   	pop    %ebp
  801cc2:	c3                   	ret    
			sys_yield();
  801cc3:	e8 87 ef ff ff       	call   800c4f <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801cc8:	8b 03                	mov    (%ebx),%eax
  801cca:	3b 43 04             	cmp    0x4(%ebx),%eax
  801ccd:	75 18                	jne    801ce7 <devpipe_read+0x58>
			if (i > 0)
  801ccf:	85 f6                	test   %esi,%esi
  801cd1:	75 e6                	jne    801cb9 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801cd3:	89 da                	mov    %ebx,%edx
  801cd5:	89 f8                	mov    %edi,%eax
  801cd7:	e8 c8 fe ff ff       	call   801ba4 <_pipeisclosed>
  801cdc:	85 c0                	test   %eax,%eax
  801cde:	74 e3                	je     801cc3 <devpipe_read+0x34>
				return 0;
  801ce0:	b8 00 00 00 00       	mov    $0x0,%eax
  801ce5:	eb d4                	jmp    801cbb <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801ce7:	99                   	cltd   
  801ce8:	c1 ea 1b             	shr    $0x1b,%edx
  801ceb:	01 d0                	add    %edx,%eax
  801ced:	83 e0 1f             	and    $0x1f,%eax
  801cf0:	29 d0                	sub    %edx,%eax
  801cf2:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801cf7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801cfa:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801cfd:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801d00:	83 c6 01             	add    $0x1,%esi
  801d03:	eb aa                	jmp    801caf <devpipe_read+0x20>

00801d05 <pipe>:
{
  801d05:	f3 0f 1e fb          	endbr32 
  801d09:	55                   	push   %ebp
  801d0a:	89 e5                	mov    %esp,%ebp
  801d0c:	56                   	push   %esi
  801d0d:	53                   	push   %ebx
  801d0e:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801d11:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801d14:	50                   	push   %eax
  801d15:	e8 ef f5 ff ff       	call   801309 <fd_alloc>
  801d1a:	89 c3                	mov    %eax,%ebx
  801d1c:	83 c4 10             	add    $0x10,%esp
  801d1f:	85 c0                	test   %eax,%eax
  801d21:	0f 88 23 01 00 00    	js     801e4a <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d27:	83 ec 04             	sub    $0x4,%esp
  801d2a:	68 07 04 00 00       	push   $0x407
  801d2f:	ff 75 f4             	pushl  -0xc(%ebp)
  801d32:	6a 00                	push   $0x0
  801d34:	e8 39 ef ff ff       	call   800c72 <sys_page_alloc>
  801d39:	89 c3                	mov    %eax,%ebx
  801d3b:	83 c4 10             	add    $0x10,%esp
  801d3e:	85 c0                	test   %eax,%eax
  801d40:	0f 88 04 01 00 00    	js     801e4a <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801d46:	83 ec 0c             	sub    $0xc,%esp
  801d49:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801d4c:	50                   	push   %eax
  801d4d:	e8 b7 f5 ff ff       	call   801309 <fd_alloc>
  801d52:	89 c3                	mov    %eax,%ebx
  801d54:	83 c4 10             	add    $0x10,%esp
  801d57:	85 c0                	test   %eax,%eax
  801d59:	0f 88 db 00 00 00    	js     801e3a <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d5f:	83 ec 04             	sub    $0x4,%esp
  801d62:	68 07 04 00 00       	push   $0x407
  801d67:	ff 75 f0             	pushl  -0x10(%ebp)
  801d6a:	6a 00                	push   $0x0
  801d6c:	e8 01 ef ff ff       	call   800c72 <sys_page_alloc>
  801d71:	89 c3                	mov    %eax,%ebx
  801d73:	83 c4 10             	add    $0x10,%esp
  801d76:	85 c0                	test   %eax,%eax
  801d78:	0f 88 bc 00 00 00    	js     801e3a <pipe+0x135>
	va = fd2data(fd0);
  801d7e:	83 ec 0c             	sub    $0xc,%esp
  801d81:	ff 75 f4             	pushl  -0xc(%ebp)
  801d84:	e8 65 f5 ff ff       	call   8012ee <fd2data>
  801d89:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d8b:	83 c4 0c             	add    $0xc,%esp
  801d8e:	68 07 04 00 00       	push   $0x407
  801d93:	50                   	push   %eax
  801d94:	6a 00                	push   $0x0
  801d96:	e8 d7 ee ff ff       	call   800c72 <sys_page_alloc>
  801d9b:	89 c3                	mov    %eax,%ebx
  801d9d:	83 c4 10             	add    $0x10,%esp
  801da0:	85 c0                	test   %eax,%eax
  801da2:	0f 88 82 00 00 00    	js     801e2a <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801da8:	83 ec 0c             	sub    $0xc,%esp
  801dab:	ff 75 f0             	pushl  -0x10(%ebp)
  801dae:	e8 3b f5 ff ff       	call   8012ee <fd2data>
  801db3:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801dba:	50                   	push   %eax
  801dbb:	6a 00                	push   $0x0
  801dbd:	56                   	push   %esi
  801dbe:	6a 00                	push   $0x0
  801dc0:	e8 f4 ee ff ff       	call   800cb9 <sys_page_map>
  801dc5:	89 c3                	mov    %eax,%ebx
  801dc7:	83 c4 20             	add    $0x20,%esp
  801dca:	85 c0                	test   %eax,%eax
  801dcc:	78 4e                	js     801e1c <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801dce:	a1 20 30 80 00       	mov    0x803020,%eax
  801dd3:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801dd6:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801dd8:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801ddb:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801de2:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801de5:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801de7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801dea:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801df1:	83 ec 0c             	sub    $0xc,%esp
  801df4:	ff 75 f4             	pushl  -0xc(%ebp)
  801df7:	e8 de f4 ff ff       	call   8012da <fd2num>
  801dfc:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dff:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801e01:	83 c4 04             	add    $0x4,%esp
  801e04:	ff 75 f0             	pushl  -0x10(%ebp)
  801e07:	e8 ce f4 ff ff       	call   8012da <fd2num>
  801e0c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801e0f:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801e12:	83 c4 10             	add    $0x10,%esp
  801e15:	bb 00 00 00 00       	mov    $0x0,%ebx
  801e1a:	eb 2e                	jmp    801e4a <pipe+0x145>
	sys_page_unmap(0, va);
  801e1c:	83 ec 08             	sub    $0x8,%esp
  801e1f:	56                   	push   %esi
  801e20:	6a 00                	push   $0x0
  801e22:	e8 d8 ee ff ff       	call   800cff <sys_page_unmap>
  801e27:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801e2a:	83 ec 08             	sub    $0x8,%esp
  801e2d:	ff 75 f0             	pushl  -0x10(%ebp)
  801e30:	6a 00                	push   $0x0
  801e32:	e8 c8 ee ff ff       	call   800cff <sys_page_unmap>
  801e37:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801e3a:	83 ec 08             	sub    $0x8,%esp
  801e3d:	ff 75 f4             	pushl  -0xc(%ebp)
  801e40:	6a 00                	push   $0x0
  801e42:	e8 b8 ee ff ff       	call   800cff <sys_page_unmap>
  801e47:	83 c4 10             	add    $0x10,%esp
}
  801e4a:	89 d8                	mov    %ebx,%eax
  801e4c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e4f:	5b                   	pop    %ebx
  801e50:	5e                   	pop    %esi
  801e51:	5d                   	pop    %ebp
  801e52:	c3                   	ret    

00801e53 <pipeisclosed>:
{
  801e53:	f3 0f 1e fb          	endbr32 
  801e57:	55                   	push   %ebp
  801e58:	89 e5                	mov    %esp,%ebp
  801e5a:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e5d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e60:	50                   	push   %eax
  801e61:	ff 75 08             	pushl  0x8(%ebp)
  801e64:	e8 f6 f4 ff ff       	call   80135f <fd_lookup>
  801e69:	83 c4 10             	add    $0x10,%esp
  801e6c:	85 c0                	test   %eax,%eax
  801e6e:	78 18                	js     801e88 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801e70:	83 ec 0c             	sub    $0xc,%esp
  801e73:	ff 75 f4             	pushl  -0xc(%ebp)
  801e76:	e8 73 f4 ff ff       	call   8012ee <fd2data>
  801e7b:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801e7d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e80:	e8 1f fd ff ff       	call   801ba4 <_pipeisclosed>
  801e85:	83 c4 10             	add    $0x10,%esp
}
  801e88:	c9                   	leave  
  801e89:	c3                   	ret    

00801e8a <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801e8a:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801e8e:	b8 00 00 00 00       	mov    $0x0,%eax
  801e93:	c3                   	ret    

00801e94 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801e94:	f3 0f 1e fb          	endbr32 
  801e98:	55                   	push   %ebp
  801e99:	89 e5                	mov    %esp,%ebp
  801e9b:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801e9e:	68 3a 29 80 00       	push   $0x80293a
  801ea3:	ff 75 0c             	pushl  0xc(%ebp)
  801ea6:	e8 85 e9 ff ff       	call   800830 <strcpy>
	return 0;
}
  801eab:	b8 00 00 00 00       	mov    $0x0,%eax
  801eb0:	c9                   	leave  
  801eb1:	c3                   	ret    

00801eb2 <devcons_write>:
{
  801eb2:	f3 0f 1e fb          	endbr32 
  801eb6:	55                   	push   %ebp
  801eb7:	89 e5                	mov    %esp,%ebp
  801eb9:	57                   	push   %edi
  801eba:	56                   	push   %esi
  801ebb:	53                   	push   %ebx
  801ebc:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801ec2:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801ec7:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801ecd:	3b 75 10             	cmp    0x10(%ebp),%esi
  801ed0:	73 31                	jae    801f03 <devcons_write+0x51>
		m = n - tot;
  801ed2:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801ed5:	29 f3                	sub    %esi,%ebx
  801ed7:	83 fb 7f             	cmp    $0x7f,%ebx
  801eda:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801edf:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801ee2:	83 ec 04             	sub    $0x4,%esp
  801ee5:	53                   	push   %ebx
  801ee6:	89 f0                	mov    %esi,%eax
  801ee8:	03 45 0c             	add    0xc(%ebp),%eax
  801eeb:	50                   	push   %eax
  801eec:	57                   	push   %edi
  801eed:	e8 f4 ea ff ff       	call   8009e6 <memmove>
		sys_cputs(buf, m);
  801ef2:	83 c4 08             	add    $0x8,%esp
  801ef5:	53                   	push   %ebx
  801ef6:	57                   	push   %edi
  801ef7:	e8 a6 ec ff ff       	call   800ba2 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801efc:	01 de                	add    %ebx,%esi
  801efe:	83 c4 10             	add    $0x10,%esp
  801f01:	eb ca                	jmp    801ecd <devcons_write+0x1b>
}
  801f03:	89 f0                	mov    %esi,%eax
  801f05:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801f08:	5b                   	pop    %ebx
  801f09:	5e                   	pop    %esi
  801f0a:	5f                   	pop    %edi
  801f0b:	5d                   	pop    %ebp
  801f0c:	c3                   	ret    

00801f0d <devcons_read>:
{
  801f0d:	f3 0f 1e fb          	endbr32 
  801f11:	55                   	push   %ebp
  801f12:	89 e5                	mov    %esp,%ebp
  801f14:	83 ec 08             	sub    $0x8,%esp
  801f17:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801f1c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801f20:	74 21                	je     801f43 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801f22:	e8 9d ec ff ff       	call   800bc4 <sys_cgetc>
  801f27:	85 c0                	test   %eax,%eax
  801f29:	75 07                	jne    801f32 <devcons_read+0x25>
		sys_yield();
  801f2b:	e8 1f ed ff ff       	call   800c4f <sys_yield>
  801f30:	eb f0                	jmp    801f22 <devcons_read+0x15>
	if (c < 0)
  801f32:	78 0f                	js     801f43 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801f34:	83 f8 04             	cmp    $0x4,%eax
  801f37:	74 0c                	je     801f45 <devcons_read+0x38>
	*(char*)vbuf = c;
  801f39:	8b 55 0c             	mov    0xc(%ebp),%edx
  801f3c:	88 02                	mov    %al,(%edx)
	return 1;
  801f3e:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801f43:	c9                   	leave  
  801f44:	c3                   	ret    
		return 0;
  801f45:	b8 00 00 00 00       	mov    $0x0,%eax
  801f4a:	eb f7                	jmp    801f43 <devcons_read+0x36>

00801f4c <cputchar>:
{
  801f4c:	f3 0f 1e fb          	endbr32 
  801f50:	55                   	push   %ebp
  801f51:	89 e5                	mov    %esp,%ebp
  801f53:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801f56:	8b 45 08             	mov    0x8(%ebp),%eax
  801f59:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801f5c:	6a 01                	push   $0x1
  801f5e:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f61:	50                   	push   %eax
  801f62:	e8 3b ec ff ff       	call   800ba2 <sys_cputs>
}
  801f67:	83 c4 10             	add    $0x10,%esp
  801f6a:	c9                   	leave  
  801f6b:	c3                   	ret    

00801f6c <getchar>:
{
  801f6c:	f3 0f 1e fb          	endbr32 
  801f70:	55                   	push   %ebp
  801f71:	89 e5                	mov    %esp,%ebp
  801f73:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801f76:	6a 01                	push   $0x1
  801f78:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f7b:	50                   	push   %eax
  801f7c:	6a 00                	push   $0x0
  801f7e:	e8 5f f6 ff ff       	call   8015e2 <read>
	if (r < 0)
  801f83:	83 c4 10             	add    $0x10,%esp
  801f86:	85 c0                	test   %eax,%eax
  801f88:	78 06                	js     801f90 <getchar+0x24>
	if (r < 1)
  801f8a:	74 06                	je     801f92 <getchar+0x26>
	return c;
  801f8c:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801f90:	c9                   	leave  
  801f91:	c3                   	ret    
		return -E_EOF;
  801f92:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801f97:	eb f7                	jmp    801f90 <getchar+0x24>

00801f99 <iscons>:
{
  801f99:	f3 0f 1e fb          	endbr32 
  801f9d:	55                   	push   %ebp
  801f9e:	89 e5                	mov    %esp,%ebp
  801fa0:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801fa3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801fa6:	50                   	push   %eax
  801fa7:	ff 75 08             	pushl  0x8(%ebp)
  801faa:	e8 b0 f3 ff ff       	call   80135f <fd_lookup>
  801faf:	83 c4 10             	add    $0x10,%esp
  801fb2:	85 c0                	test   %eax,%eax
  801fb4:	78 11                	js     801fc7 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801fb6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fb9:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801fbf:	39 10                	cmp    %edx,(%eax)
  801fc1:	0f 94 c0             	sete   %al
  801fc4:	0f b6 c0             	movzbl %al,%eax
}
  801fc7:	c9                   	leave  
  801fc8:	c3                   	ret    

00801fc9 <opencons>:
{
  801fc9:	f3 0f 1e fb          	endbr32 
  801fcd:	55                   	push   %ebp
  801fce:	89 e5                	mov    %esp,%ebp
  801fd0:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801fd3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801fd6:	50                   	push   %eax
  801fd7:	e8 2d f3 ff ff       	call   801309 <fd_alloc>
  801fdc:	83 c4 10             	add    $0x10,%esp
  801fdf:	85 c0                	test   %eax,%eax
  801fe1:	78 3a                	js     80201d <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801fe3:	83 ec 04             	sub    $0x4,%esp
  801fe6:	68 07 04 00 00       	push   $0x407
  801feb:	ff 75 f4             	pushl  -0xc(%ebp)
  801fee:	6a 00                	push   $0x0
  801ff0:	e8 7d ec ff ff       	call   800c72 <sys_page_alloc>
  801ff5:	83 c4 10             	add    $0x10,%esp
  801ff8:	85 c0                	test   %eax,%eax
  801ffa:	78 21                	js     80201d <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801ffc:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fff:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  802005:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  802007:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80200a:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  802011:	83 ec 0c             	sub    $0xc,%esp
  802014:	50                   	push   %eax
  802015:	e8 c0 f2 ff ff       	call   8012da <fd2num>
  80201a:	83 c4 10             	add    $0x10,%esp
}
  80201d:	c9                   	leave  
  80201e:	c3                   	ret    

0080201f <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  80201f:	f3 0f 1e fb          	endbr32 
  802023:	55                   	push   %ebp
  802024:	89 e5                	mov    %esp,%ebp
  802026:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  802029:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  802030:	74 27                	je     802059 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  802032:	8b 45 08             	mov    0x8(%ebp),%eax
  802035:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  80203a:	a1 04 40 80 00       	mov    0x804004,%eax
  80203f:	8b 40 48             	mov    0x48(%eax),%eax
  802042:	83 ec 08             	sub    $0x8,%esp
  802045:	68 99 20 80 00       	push   $0x802099
  80204a:	50                   	push   %eax
  80204b:	e8 81 ed ff ff       	call   800dd1 <sys_env_set_pgfault_upcall>
  802050:	83 c4 10             	add    $0x10,%esp
  802053:	85 c0                	test   %eax,%eax
  802055:	78 2e                	js     802085 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  802057:	c9                   	leave  
  802058:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  802059:	83 ec 04             	sub    $0x4,%esp
  80205c:	6a 07                	push   $0x7
  80205e:	68 00 f0 bf ee       	push   $0xeebff000
  802063:	6a 00                	push   $0x0
  802065:	e8 08 ec ff ff       	call   800c72 <sys_page_alloc>
  80206a:	83 c4 10             	add    $0x10,%esp
  80206d:	85 c0                	test   %eax,%eax
  80206f:	79 c1                	jns    802032 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  802071:	83 ec 04             	sub    $0x4,%esp
  802074:	68 48 29 80 00       	push   $0x802948
  802079:	6a 21                	push   $0x21
  80207b:	68 aa 29 80 00       	push   $0x8029aa
  802080:	e8 eb e0 ff ff       	call   800170 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  802085:	83 ec 04             	sub    $0x4,%esp
  802088:	68 74 29 80 00       	push   $0x802974
  80208d:	6a 27                	push   $0x27
  80208f:	68 aa 29 80 00       	push   $0x8029aa
  802094:	e8 d7 e0 ff ff       	call   800170 <_panic>

00802099 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  802099:	54                   	push   %esp
	movl _pgfault_handler, %eax
  80209a:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  80209f:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  8020a1:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  8020a4:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  8020a8:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  8020ab:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  8020af:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  8020b3:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  8020b6:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  8020b9:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  8020ba:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  8020bd:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  8020be:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  8020bf:	c3                   	ret    

008020c0 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  8020c0:	f3 0f 1e fb          	endbr32 
  8020c4:	55                   	push   %ebp
  8020c5:	89 e5                	mov    %esp,%ebp
  8020c7:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8020ca:	89 c2                	mov    %eax,%edx
  8020cc:	c1 ea 16             	shr    $0x16,%edx
  8020cf:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8020d6:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8020db:	f6 c1 01             	test   $0x1,%cl
  8020de:	74 1c                	je     8020fc <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8020e0:	c1 e8 0c             	shr    $0xc,%eax
  8020e3:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020ea:	a8 01                	test   $0x1,%al
  8020ec:	74 0e                	je     8020fc <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020ee:	c1 e8 0c             	shr    $0xc,%eax
  8020f1:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8020f8:	ef 
  8020f9:	0f b7 d2             	movzwl %dx,%edx
}
  8020fc:	89 d0                	mov    %edx,%eax
  8020fe:	5d                   	pop    %ebp
  8020ff:	c3                   	ret    

00802100 <__udivdi3>:
  802100:	f3 0f 1e fb          	endbr32 
  802104:	55                   	push   %ebp
  802105:	57                   	push   %edi
  802106:	56                   	push   %esi
  802107:	53                   	push   %ebx
  802108:	83 ec 1c             	sub    $0x1c,%esp
  80210b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  80210f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  802113:	8b 74 24 34          	mov    0x34(%esp),%esi
  802117:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  80211b:	85 d2                	test   %edx,%edx
  80211d:	75 19                	jne    802138 <__udivdi3+0x38>
  80211f:	39 f3                	cmp    %esi,%ebx
  802121:	76 4d                	jbe    802170 <__udivdi3+0x70>
  802123:	31 ff                	xor    %edi,%edi
  802125:	89 e8                	mov    %ebp,%eax
  802127:	89 f2                	mov    %esi,%edx
  802129:	f7 f3                	div    %ebx
  80212b:	89 fa                	mov    %edi,%edx
  80212d:	83 c4 1c             	add    $0x1c,%esp
  802130:	5b                   	pop    %ebx
  802131:	5e                   	pop    %esi
  802132:	5f                   	pop    %edi
  802133:	5d                   	pop    %ebp
  802134:	c3                   	ret    
  802135:	8d 76 00             	lea    0x0(%esi),%esi
  802138:	39 f2                	cmp    %esi,%edx
  80213a:	76 14                	jbe    802150 <__udivdi3+0x50>
  80213c:	31 ff                	xor    %edi,%edi
  80213e:	31 c0                	xor    %eax,%eax
  802140:	89 fa                	mov    %edi,%edx
  802142:	83 c4 1c             	add    $0x1c,%esp
  802145:	5b                   	pop    %ebx
  802146:	5e                   	pop    %esi
  802147:	5f                   	pop    %edi
  802148:	5d                   	pop    %ebp
  802149:	c3                   	ret    
  80214a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802150:	0f bd fa             	bsr    %edx,%edi
  802153:	83 f7 1f             	xor    $0x1f,%edi
  802156:	75 48                	jne    8021a0 <__udivdi3+0xa0>
  802158:	39 f2                	cmp    %esi,%edx
  80215a:	72 06                	jb     802162 <__udivdi3+0x62>
  80215c:	31 c0                	xor    %eax,%eax
  80215e:	39 eb                	cmp    %ebp,%ebx
  802160:	77 de                	ja     802140 <__udivdi3+0x40>
  802162:	b8 01 00 00 00       	mov    $0x1,%eax
  802167:	eb d7                	jmp    802140 <__udivdi3+0x40>
  802169:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802170:	89 d9                	mov    %ebx,%ecx
  802172:	85 db                	test   %ebx,%ebx
  802174:	75 0b                	jne    802181 <__udivdi3+0x81>
  802176:	b8 01 00 00 00       	mov    $0x1,%eax
  80217b:	31 d2                	xor    %edx,%edx
  80217d:	f7 f3                	div    %ebx
  80217f:	89 c1                	mov    %eax,%ecx
  802181:	31 d2                	xor    %edx,%edx
  802183:	89 f0                	mov    %esi,%eax
  802185:	f7 f1                	div    %ecx
  802187:	89 c6                	mov    %eax,%esi
  802189:	89 e8                	mov    %ebp,%eax
  80218b:	89 f7                	mov    %esi,%edi
  80218d:	f7 f1                	div    %ecx
  80218f:	89 fa                	mov    %edi,%edx
  802191:	83 c4 1c             	add    $0x1c,%esp
  802194:	5b                   	pop    %ebx
  802195:	5e                   	pop    %esi
  802196:	5f                   	pop    %edi
  802197:	5d                   	pop    %ebp
  802198:	c3                   	ret    
  802199:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8021a0:	89 f9                	mov    %edi,%ecx
  8021a2:	b8 20 00 00 00       	mov    $0x20,%eax
  8021a7:	29 f8                	sub    %edi,%eax
  8021a9:	d3 e2                	shl    %cl,%edx
  8021ab:	89 54 24 08          	mov    %edx,0x8(%esp)
  8021af:	89 c1                	mov    %eax,%ecx
  8021b1:	89 da                	mov    %ebx,%edx
  8021b3:	d3 ea                	shr    %cl,%edx
  8021b5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8021b9:	09 d1                	or     %edx,%ecx
  8021bb:	89 f2                	mov    %esi,%edx
  8021bd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8021c1:	89 f9                	mov    %edi,%ecx
  8021c3:	d3 e3                	shl    %cl,%ebx
  8021c5:	89 c1                	mov    %eax,%ecx
  8021c7:	d3 ea                	shr    %cl,%edx
  8021c9:	89 f9                	mov    %edi,%ecx
  8021cb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8021cf:	89 eb                	mov    %ebp,%ebx
  8021d1:	d3 e6                	shl    %cl,%esi
  8021d3:	89 c1                	mov    %eax,%ecx
  8021d5:	d3 eb                	shr    %cl,%ebx
  8021d7:	09 de                	or     %ebx,%esi
  8021d9:	89 f0                	mov    %esi,%eax
  8021db:	f7 74 24 08          	divl   0x8(%esp)
  8021df:	89 d6                	mov    %edx,%esi
  8021e1:	89 c3                	mov    %eax,%ebx
  8021e3:	f7 64 24 0c          	mull   0xc(%esp)
  8021e7:	39 d6                	cmp    %edx,%esi
  8021e9:	72 15                	jb     802200 <__udivdi3+0x100>
  8021eb:	89 f9                	mov    %edi,%ecx
  8021ed:	d3 e5                	shl    %cl,%ebp
  8021ef:	39 c5                	cmp    %eax,%ebp
  8021f1:	73 04                	jae    8021f7 <__udivdi3+0xf7>
  8021f3:	39 d6                	cmp    %edx,%esi
  8021f5:	74 09                	je     802200 <__udivdi3+0x100>
  8021f7:	89 d8                	mov    %ebx,%eax
  8021f9:	31 ff                	xor    %edi,%edi
  8021fb:	e9 40 ff ff ff       	jmp    802140 <__udivdi3+0x40>
  802200:	8d 43 ff             	lea    -0x1(%ebx),%eax
  802203:	31 ff                	xor    %edi,%edi
  802205:	e9 36 ff ff ff       	jmp    802140 <__udivdi3+0x40>
  80220a:	66 90                	xchg   %ax,%ax
  80220c:	66 90                	xchg   %ax,%ax
  80220e:	66 90                	xchg   %ax,%ax

00802210 <__umoddi3>:
  802210:	f3 0f 1e fb          	endbr32 
  802214:	55                   	push   %ebp
  802215:	57                   	push   %edi
  802216:	56                   	push   %esi
  802217:	53                   	push   %ebx
  802218:	83 ec 1c             	sub    $0x1c,%esp
  80221b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  80221f:	8b 74 24 30          	mov    0x30(%esp),%esi
  802223:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802227:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80222b:	85 c0                	test   %eax,%eax
  80222d:	75 19                	jne    802248 <__umoddi3+0x38>
  80222f:	39 df                	cmp    %ebx,%edi
  802231:	76 5d                	jbe    802290 <__umoddi3+0x80>
  802233:	89 f0                	mov    %esi,%eax
  802235:	89 da                	mov    %ebx,%edx
  802237:	f7 f7                	div    %edi
  802239:	89 d0                	mov    %edx,%eax
  80223b:	31 d2                	xor    %edx,%edx
  80223d:	83 c4 1c             	add    $0x1c,%esp
  802240:	5b                   	pop    %ebx
  802241:	5e                   	pop    %esi
  802242:	5f                   	pop    %edi
  802243:	5d                   	pop    %ebp
  802244:	c3                   	ret    
  802245:	8d 76 00             	lea    0x0(%esi),%esi
  802248:	89 f2                	mov    %esi,%edx
  80224a:	39 d8                	cmp    %ebx,%eax
  80224c:	76 12                	jbe    802260 <__umoddi3+0x50>
  80224e:	89 f0                	mov    %esi,%eax
  802250:	89 da                	mov    %ebx,%edx
  802252:	83 c4 1c             	add    $0x1c,%esp
  802255:	5b                   	pop    %ebx
  802256:	5e                   	pop    %esi
  802257:	5f                   	pop    %edi
  802258:	5d                   	pop    %ebp
  802259:	c3                   	ret    
  80225a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802260:	0f bd e8             	bsr    %eax,%ebp
  802263:	83 f5 1f             	xor    $0x1f,%ebp
  802266:	75 50                	jne    8022b8 <__umoddi3+0xa8>
  802268:	39 d8                	cmp    %ebx,%eax
  80226a:	0f 82 e0 00 00 00    	jb     802350 <__umoddi3+0x140>
  802270:	89 d9                	mov    %ebx,%ecx
  802272:	39 f7                	cmp    %esi,%edi
  802274:	0f 86 d6 00 00 00    	jbe    802350 <__umoddi3+0x140>
  80227a:	89 d0                	mov    %edx,%eax
  80227c:	89 ca                	mov    %ecx,%edx
  80227e:	83 c4 1c             	add    $0x1c,%esp
  802281:	5b                   	pop    %ebx
  802282:	5e                   	pop    %esi
  802283:	5f                   	pop    %edi
  802284:	5d                   	pop    %ebp
  802285:	c3                   	ret    
  802286:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80228d:	8d 76 00             	lea    0x0(%esi),%esi
  802290:	89 fd                	mov    %edi,%ebp
  802292:	85 ff                	test   %edi,%edi
  802294:	75 0b                	jne    8022a1 <__umoddi3+0x91>
  802296:	b8 01 00 00 00       	mov    $0x1,%eax
  80229b:	31 d2                	xor    %edx,%edx
  80229d:	f7 f7                	div    %edi
  80229f:	89 c5                	mov    %eax,%ebp
  8022a1:	89 d8                	mov    %ebx,%eax
  8022a3:	31 d2                	xor    %edx,%edx
  8022a5:	f7 f5                	div    %ebp
  8022a7:	89 f0                	mov    %esi,%eax
  8022a9:	f7 f5                	div    %ebp
  8022ab:	89 d0                	mov    %edx,%eax
  8022ad:	31 d2                	xor    %edx,%edx
  8022af:	eb 8c                	jmp    80223d <__umoddi3+0x2d>
  8022b1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8022b8:	89 e9                	mov    %ebp,%ecx
  8022ba:	ba 20 00 00 00       	mov    $0x20,%edx
  8022bf:	29 ea                	sub    %ebp,%edx
  8022c1:	d3 e0                	shl    %cl,%eax
  8022c3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8022c7:	89 d1                	mov    %edx,%ecx
  8022c9:	89 f8                	mov    %edi,%eax
  8022cb:	d3 e8                	shr    %cl,%eax
  8022cd:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8022d1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8022d5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8022d9:	09 c1                	or     %eax,%ecx
  8022db:	89 d8                	mov    %ebx,%eax
  8022dd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022e1:	89 e9                	mov    %ebp,%ecx
  8022e3:	d3 e7                	shl    %cl,%edi
  8022e5:	89 d1                	mov    %edx,%ecx
  8022e7:	d3 e8                	shr    %cl,%eax
  8022e9:	89 e9                	mov    %ebp,%ecx
  8022eb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022ef:	d3 e3                	shl    %cl,%ebx
  8022f1:	89 c7                	mov    %eax,%edi
  8022f3:	89 d1                	mov    %edx,%ecx
  8022f5:	89 f0                	mov    %esi,%eax
  8022f7:	d3 e8                	shr    %cl,%eax
  8022f9:	89 e9                	mov    %ebp,%ecx
  8022fb:	89 fa                	mov    %edi,%edx
  8022fd:	d3 e6                	shl    %cl,%esi
  8022ff:	09 d8                	or     %ebx,%eax
  802301:	f7 74 24 08          	divl   0x8(%esp)
  802305:	89 d1                	mov    %edx,%ecx
  802307:	89 f3                	mov    %esi,%ebx
  802309:	f7 64 24 0c          	mull   0xc(%esp)
  80230d:	89 c6                	mov    %eax,%esi
  80230f:	89 d7                	mov    %edx,%edi
  802311:	39 d1                	cmp    %edx,%ecx
  802313:	72 06                	jb     80231b <__umoddi3+0x10b>
  802315:	75 10                	jne    802327 <__umoddi3+0x117>
  802317:	39 c3                	cmp    %eax,%ebx
  802319:	73 0c                	jae    802327 <__umoddi3+0x117>
  80231b:	2b 44 24 0c          	sub    0xc(%esp),%eax
  80231f:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802323:	89 d7                	mov    %edx,%edi
  802325:	89 c6                	mov    %eax,%esi
  802327:	89 ca                	mov    %ecx,%edx
  802329:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80232e:	29 f3                	sub    %esi,%ebx
  802330:	19 fa                	sbb    %edi,%edx
  802332:	89 d0                	mov    %edx,%eax
  802334:	d3 e0                	shl    %cl,%eax
  802336:	89 e9                	mov    %ebp,%ecx
  802338:	d3 eb                	shr    %cl,%ebx
  80233a:	d3 ea                	shr    %cl,%edx
  80233c:	09 d8                	or     %ebx,%eax
  80233e:	83 c4 1c             	add    $0x1c,%esp
  802341:	5b                   	pop    %ebx
  802342:	5e                   	pop    %esi
  802343:	5f                   	pop    %edi
  802344:	5d                   	pop    %ebp
  802345:	c3                   	ret    
  802346:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80234d:	8d 76 00             	lea    0x0(%esi),%esi
  802350:	29 fe                	sub    %edi,%esi
  802352:	19 c3                	sbb    %eax,%ebx
  802354:	89 f2                	mov    %esi,%edx
  802356:	89 d9                	mov    %ebx,%ecx
  802358:	e9 1d ff ff ff       	jmp    80227a <__umoddi3+0x6a>
